fork download
  1.  
  2. /*
  3.  * Author: nerdyninja
  4.  * TCQF181D
  5.  */
  6. #include <bits/stdc++.h>
  7.  
  8. using namespace std;
  9.  
  10. bool cmp(const pair<string,int> &a, const pair<string,int> &b)
  11. {
  12. return (a.second > b.second);
  13. }
  14.  
  15. int main()
  16. {
  17. ios_base::sync_with_stdio(0);
  18. // Start Solution here
  19. int t, n, y;
  20. string f_one, f_two, x;
  21. cin >> t;
  22. while (t--) {
  23. cin >> n;
  24. cin >> f_one >> f_two;
  25. vector< pair <string, int> > vp;
  26. for (int i = 0; i < n; i++) {
  27. cin >> x >> y;
  28. vp.push_back(make_pair(x, y));
  29. }
  30. sort(vp.begin(), vp.end(), cmp);
  31. if (vp[0].first == f_one && vp[1].first == f_two) cout << "right" << endl;
  32. else if (vp[0].first == f_two && vp[1].first == f_one) cout << "right" << endl;
  33. else cout << "wrong" << endl;
  34. }
  35. // End Solution here
  36. return 0;
  37. }
Success #stdin #stdout 0s 15248KB
stdin
Standard input is empty
stdout
Standard output is empty