Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <cstdio>
- #include <iomanip>
- #include <queue>
- #include <ctime>
- #include <cmath>
- #include <map>
- #include <string>
- using namespace std;
- #define _CRT_SECURE_NO_WARNINGS
- #define loop(i,start,end) for(auto i = start;i < end;i ++)
- #define loopi(end) loop(i,0,end)
- #define loopj(end) loop(j,0,end)
- bool comp(pair<string, pair<int, int>>& fst, pair<string, pair<int, int>> & sec) {
- if (fst.second.first != sec.second.first) return fst.second.first > sec.second.first;
- else return fst.first < sec.first;
- }
- int main() {
- int n; cin >> n;
- int days_s[] = {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
- };
- map<string, pair<int, int>> team;
- map<int, pair<int, int>> time;
- loopi(n) {
- string t, s, e, a;
- cin >> t >> s >> e >> a;
- if (team.find(a) == team.end()) {
- team.insert(pair<string, pair<int, int>>(a, pair<int, int>(1, i)));
- time.insert(pair<int, pair<int, int>>(i, pair<int, int>(days_s[stoi(s.substr(5, 2)) - 1] + stoi(s.substr(8, 2)), days_s[stoi(e.substr(5, 2)) - 1] + stoi(e.substr(8, 2)))));
- }
- else
- if (time[team[a].second].first >= days_s[stoi(s.substr(5, 2)) - 1] + stoi(s.substr(8, 2)) || time[team[a].second].second <= days_s[stoi(e.substr(5, 2)) - 1] + stoi(e.substr(8, 2))) team[a].first++;
- }
- map <int, string> ans;
- for (auto it : team)
- ans.insert(pair<int, string>(it.second.first, it.first));
- for (auto it = ans.rbegin(); it!=ans.rend(); it++)
- cout << it->second << " " << it->first << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement