Hi Everyone,
Today I encountered a new type of problem which involved an interactive task. The problem link is as follows:
https://atcoder.jp/contests/abc269/tasks/abc269_e
These kind of problems are new to me. Nevertheless, I tried solving it and here is my solution (in C++):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll t,i,n,a[4];
cin>>n;
while(true){
for(i=0;i<4;i++) a[i]=(rand()%n)+1;
cout<<"? "<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<endl;
// cout<<flush;
cin>>t;
if(t==0){
cout<<"! "<<a[1]<<" "<<a[3]<<endl;
// cout<<flush;
exit(0);
}
if(t==-1) exit(0);
}
return 0;
}
I received WA after submitting this solution. I also tried adding "cout<<flush" which are commented now, but that did not help.
Can someone pls help me to correct the solution?