SHARE
TWEET

fff

a guest Oct 18th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <cstdio>
  5. #include <iomanip>
  6. #include <queue>
  7. #include <ctime>
  8. #include <cmath>
  9. #include <map>
  10. #include <string>
  11.  
  12. using namespace std;
  13.  
  14. #define _CRT_SECURE_NO_WARNINGS
  15. #define loop(i,start,end) for(auto i = start;i < end;i ++)
  16. #define loopi(end) loop(i,0,end)
  17. #define loopj(end) loop(j,0,end)
  18.  
  19. bool comp(pair<string, pair<int, int>>& fst, pair<string, pair<int, int>> & sec) {
  20.     if (fst.second.first != sec.second.first) return fst.second.first > sec.second.first;
  21.     else return fst.first < sec.first;
  22. }
  23.  
  24. int main() {
  25.     int n; cin >> n;
  26.     int days_s[] = {
  27.         0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
  28.     };
  29.     map<string, pair<int, int>> team;
  30.     map<int, pair<int, int>> time;
  31.     loopi(n) {
  32.         string t, s, e, a;
  33.         cin >> t >> s >> e >> a;
  34.         if (team.find(a) == team.end()) {
  35.             team.insert(pair<string, pair<int, int>>(a, pair<int, int>(1, i)));
  36.             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)))));
  37.         }
  38.         else
  39.             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++;
  40.     }
  41.     map <int, string> ans;
  42.     for (auto it : team)
  43.         ans.insert(pair<int, string>(it.second.first, it.first));
  44.     for (auto it = ans.rbegin(); it!=ans.rend(); it++)
  45.         cout << it->second << " " << it->first << endl;
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top