QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#695157 | #8239. Mysterious Tree | GLLF234 | WA | 1ms | 3664kb | C++20 | 1.8kb | 2024-10-31 19:26:10 | 2024-10-31 19:26:11 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
double a[100005];
void slove(){
int n;
cin>>n;
for(int i=1;i<=n;i+=2){
cout<<'?'<<" "<<i<<" "<<i+1<<endl;
fflush(stdout);
int x;
cin>>x;
if(x==1){
int k=i+2;
if(k>n) k%=n;
cout<<"?"<<" "<<i<<" "<<k<<endl;
fflush(stdout);
int y;
cin>>y;
if(y==1){
k=i+3;
if(k>n) k%=n;
cout<<"?"<<" "<<i<<" "<<k<<endl;
fflush(stdout);
int z;
cin>>z;
if(z==1){
cout<<"! 1"<<endl;
return ;
}
else {
cout<<"! 2"<<endl;
return ;
}
}
else{
cout<<"?"<<" "<<i+1<<" "<<k<<endl;
fflush(stdout);
int z;
cin>>z;
if(z==0){
cout<<"! 2"<<endl;
return ;
}
else{
k=i+3;
if(k>n) k=k%n;
cout<<"?"<<" "<<i+1<<" "<<k<<endl;
fflush(stdout);
int o;
cin>>o;
if(o==0){
cout<<"! 2"<<endl;
return ;
}
else{
cout<<"! 1"<<endl;
return ;
}
}
}
}
}
cout<<"! 2"<<endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin>>T;
while(T--){
slove();
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3664kb
input:
2 4 1 0 1 0
output:
? 1 2 ? 1 3 ? 2 3 ? 2 4 ! 2
result:
wrong answer Wrong prediction (test case 1)