QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#670189 | #8239. Mysterious Tree | test123 | WA | 1ms | 3692kb | C++14 | 1.1kb | 2024-10-23 20:47:12 | 2024-10-23 20:47:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int T,n;
bool op;
int main(){
cin>>T;
while(T--){
cin>>n;
bool flg=1;
for(int i=1;i+1<=n;i+=2){
cout<<"? "<<i<<" "<<i+1<<endl;
cin>>op;
if(op){
cout<<"? "<<i<<" "<<(i+1)%n+1<<endl;
cin>>op;
if(op){
cout<<"? "<<i<<" "<<(i+2)%n+1<<endl;
cin>>op;
if(op){
cout<<"! 2"<<endl;
flg=0;
break;
}else{
cout<<"! 1"<<endl;
flg=0;
break;
}
}else{
cout<<"? "<<i+1<<" "<<(i+1)%n+1<<endl;
cin>>op;
if(!op){
cout<<"! 1"<<endl;
flg=0;
break;
}else{
cout<<"? "<<i+1<<" "<<(i+2)%n+1<<endl;
cin>>op;
if(!op){
cout<<"! 1"<<endl;
flg=0;
break;
}else{
cout<<"! 2"<<endl;
flg=0;
break;
}
}
}
}
}
if(flg){
for(int i=1;i<=3;++i){
cout<<"? "<<n<<" "<<1<<endl;
cin>>op;
if(!op){
cout<<"! 1"<<endl;
flg=0;
break;
}
}
if(flg){
cout<<"! 2"<<endl;
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3688kb
input:
2 4 1 0 1 0 4 0 1 1 1
output:
? 1 2 ? 1 3 ? 2 3 ? 2 4 ! 1 ? 1 2 ? 3 4 ? 3 1 ? 3 2 ! 2
result:
ok Correct (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3692kb
input:
87 13 0 0 0 0 0 1 0 1 1 15 0 0 0 0 0 0 1 1 1 7 0 0 0 1 1 1 15 0 0 0 1 0 0 19 0 0 0 0 0 1 1 1 20 0 0 0 0 0 0 0 0 0 0 1 1 1
output:
? 1 2 ? 3 4 ? 5 6 ? 7 8 ? 9 10 ? 11 12 ? 11 13 ? 12 13 ? 12 1 ! 2 ? 1 2 ? 3 4 ? 5 6 ? 7 8 ? 9 10 ? 11 12 ? 13 14 ? 13 15 ? 13 1 ! 2 ? 1 2 ? 3 4 ? 5 6 ? 7 1 ? 7 1 ? 7 1 ! 2 ? 1 2 ? 3 4 ? 5 6 ? 7 8 ? 7 9 ? 8 9 ! 1 ? 1 2 ? 3 4 ? 5 6 ? 7 8 ? 9 10 ? 11 12 ? 11 13 ? 11 14 ! 2 ? 1 2 ? 3 4 ? 5 6 ? 7 8 ? 9 1...
result:
wrong answer Wrong prediction (test case 6)