Saleh127

cf 1370b

Jun 20th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define Faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. Faster
  9. test
  10. {
  11. ll n,a[10000],c,d,e=0,f,i,j,k,l;
  12. cin>>n;
  13. c=n*2;
  14. for(i=1; i<=c; i++)
  15. {
  16. cin>>a[i];
  17. }
  18. for(i=1; i<=c; i++)
  19. {
  20. if(a[i]!=0)
  21. {
  22. for(j=i+1; j<=c; j++)
  23. {
  24. d=a[i]+a[j];
  25. if(d%2==0 && a[j]!=0)
  26. {
  27. if(e==n-1) break;
  28. e++;
  29. printf("%lld %lld\n",i,j);
  30. a[j]=0;
  31. a[i]=0;
  32. break;
  33. }
  34. }
  35. }
  36. }
  37. }
  38. printf("\n");
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment