Guest User

Untitled

a guest
Jun 20th, 2020
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     long long int t;
  6.     cin>>t;
  7.     while(t--)
  8.     {
  9.         long long int n,i,j,count1=0;
  10.         cin>>n;
  11.         vector<long long int>s1,s2;
  12.         long long int arr1[2*n];
  13.         for(i=0;i<2*n;i++)
  14.         {
  15.             cin>>arr1[i];
  16.    
  17.            if(arr1[i]%2==0)
  18.            s1.push_back(i+1);
  19.            else
  20.            s2.push_back(i+1);
  21.         }
  22.         for(i=0;i<(int)s1.size()-1;i +=2)
  23.         {
  24.             if(count1<=n-2)
  25.            {
  26.                cout<<s1[i]<<" "<<s1[i+1]<<endl;
  27.             count1++;
  28.                
  29.            }
  30.            else
  31.            break;
  32.            
  33.         }
  34.         for(i=0;i<(int)s2.size()-1;i +=2)
  35.         {
  36.             if(count1<=n-2)
  37.             {cout<<s2[i]<<" "<<s2[i+1]<<endl;
  38.             count1++;}
  39.             else
  40.             break;
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment