hkshakib

Untitled

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