Help- INTXOR(dec long)

problem link- https://www.codechef.com/DEC18B/problems/INTXOR

my slution-
my solution-

#include <bits/stdc++.h>
#include  <iostream>
using namespace std;

int main()
{
   int t,n,i=5,j=6,k=7,u,v,l,m,d,q;

  cin>>t;
  while(t--)
  {
    cin>>n;
    int a[n]={0};
  
   cout<<"1 1 2 3"<<endl;fflush(stdout);
   cin>>u;
   l=u;
   cout<<"1 1 2 4"<<endl;fflush(stdout);
   cin>>v;
   m=v;
   d=l^m;
   
   cout<<"1 3 4 5"<<endl;fflush(stdout);
   cin>>u;
   a[4]=u^d;
   cout<<"1 3 4 6"<<endl;fflush(stdout);
   cin>>v;
   a[5]=v^d;
   
    while(k<=n)
    {
       cout<<"1 "<<i<<" "<<j<<" "<<k<<endl;fflush(stdout);
       cin>>u;
       a[k-1]=u^a[i-1]^a[j-1];
       k++;
       if(k<=n)
       {  cout<<"1 "<<i<<" "<<j<<" "<<k<<endl;fflush(stdout);
          cin>>v;
          a[k-1]=v^a[i-1]^a[j-1];
       }
       k++;
       i=i+2;j=j+2;
   }
     int oo,pp;
     cout<<"1 1 "<<n-1<<" "<<n<<endl;fflush(stdout);
     cin>>oo;
     a[0]=oo^a[n-2]^a[n-1];
     
       if(n%2==0){
          cout<<"1 2 "<<n-1<<" "<<n<<endl;fflush(stdout);
          cin>>pp;
          a[1]=pp^a[n-2]^a[n-1];
      }

     else{
        cout<<"1 2 "<<n-2<<" "<<n<<endl;fflush(stdout);
        cin>>pp;
       a[1]=pp^a[n-3]^a[n-1];  
     }

     q=a[0]^a[1];
     a[2]=l^q;
     a[3]=m^q;
   cout<<"2 ";
   for(int e=0;e<n;e++)
   cout<<a[e]<<" ";
   fflush(stdout);
   int c;
   cin>>c;
   
   if(c==-1)
    exit(0);
   
  }
 return 0;
}

getting WA
i think there is no mistake in mine code but still getting WA
if any please tell that testcase or mistake while interacting with grader

lmao. Nobody takes these challenges here. Learn how toask help and stop creating same post multiple times.
If somebody wants to help he will do. Creating multiple posts wont help.

2 Likes