Advertisement
hkshakib

Untitled

Mar 17th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,f=0;
  6. cin>>t;
  7. while(t--)
  8. {
  9. vector<pair<pair<int,int>,int> >v;
  10. bool flag[200]= {false};
  11. v.clear();
  12. map<pair<int,int>,bool>mp;
  13. map<pair<int,int>,int>cmp;
  14. int per,pro,time;
  15. string ver;
  16. while(cin>>per>>pro>>time>>ver)
  17. {
  18. flag[per] = true;
  19. v[per].second = per;
  20. if(ver[0]=='C' && mp[ {per,pro}]==false)
  21. {
  22. v[per].first.first--;
  23. v[per].first.second += (time+cmp[ {per,pro}]);
  24. mp[ {per,pro}]=true;
  25. }
  26. else if(ver[0]=='I')
  27. {
  28. cmp[ {per,pro}]+=20;
  29. }
  30. }
  31. sort(v.begin(),v.end());
  32. if(f)
  33. cout<<endl;
  34. f=1;
  35. for(int i=0; i<101; i++)
  36. {
  37. if(flag[v[i].second])
  38. cout<<v[i].second<<" "<<v[i].first.first*-1<<" "<<v[i].first.second<<endl;
  39. }
  40. mp.clear();
  41. cmp.clear();
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement