Ankit_132

D

Aug 7th, 2023
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 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. #define pb     push_back
  9.  
  10. int main()
  11. {
  12.     _test
  13.     {
  14.         int n;
  15.         cin>>n;
  16.  
  17.         vector<int> a(n), b(n);
  18.         for(auto &e: a)  cin>>e;
  19.         for(auto &e: b)  cin>>e;
  20.  
  21.         vector<int> c;
  22.  
  23.         for(int i=0; i<n; i++)
  24.             c.pb(a[i] - b[i]);
  25.  
  26.         vector<int> ans;
  27.         int x = *max_element(c.begin(), c.end());
  28.  
  29.         for(int i=0; i<n; i++)
  30.         {
  31.             if(x == c[i])
  32.                 ans.pb(i+1);
  33.         }
  34.  
  35.         cout<<ans.size()<<"\n";
  36.        
  37.         for(auto e: ans)
  38.             cout<<e<<" ";
  39.         cout<<"\n";
  40.     }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment