fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. bool comp(const pair<int,int> &a,const pair<int,int> &b)
  4. {
  5. if(a.first>b.first)
  6. return a.first>b.first;
  7. else if(a.first<b.first)
  8. return a.first<b.first;
  9. else
  10. {
  11. return a.second<b.second;
  12. }
  13. }
  14. map<pair<int,int>,string>m;
  15.  
  16. int main()
  17. {
  18.  
  19.  
  20. int n,t;
  21. cin>>t;
  22. while(t--)
  23. {
  24. int a,b;
  25. cin>>n;
  26. pair<int,int>p[100];string s;
  27. for(int i=0;i<n;++i)
  28. {
  29. cin>>s;
  30. cin>>a>>b;
  31. p[i].first=a;p[i].second=b;
  32. m[p[i]]=s;
  33. }
  34. sort(p,p+n,comp);
  35. cout<<m[p[0]]<<"\n";m.clear();
  36.  
  37.  
  38. }
  39.  
  40.  
  41. return 0;
  42.  
  43.  
  44. }
  45.  
Runtime error #stdin #stdout 0s 3148KB
stdin
Standard input is empty
stdout
Standard output is empty