Ankit_132

B

Jul 21st, 2023
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define ll     long long
  7. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  8.  
  9. int main()
  10. {
  11.     _test
  12.     {
  13.         int n;
  14.         cin>>n;
  15.  
  16.         int ans;
  17.         int x = 0;
  18.         for(int i=0; i<n; i++)
  19.         {
  20.             int a, b;
  21.             cin>>a>>b;
  22.  
  23.             if(a > 10)      continue;
  24.  
  25.             if(b > x)
  26.             {
  27.                 x = b;
  28.                 ans = i+1;
  29.             }
  30.         }
  31.  
  32.         cout<<ans<<"\n";
  33.     }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment