Ankit_132

A

Sep 10th, 2023
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 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.         vector<int> a(n);
  17.         for(auto &e: a)
  18.             cin>>e;
  19.  
  20.         if(n%2 == 0)
  21.         {
  22.             cout<<2<<"\n";
  23.             cout<<1<<" "<<n<<"\n";
  24.             cout<<1<<" "<<n<<"\n";
  25.            
  26.             continue;
  27.         }
  28.  
  29.         cout<<4<<"\n";
  30.         cout<<2<<" "<<n<<"\n";
  31.         cout<<2<<" "<<n<<"\n";
  32.         cout<<1<<" "<<2<<"\n";
  33.         cout<<1<<" "<<2<<"\n";
  34.     }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment