QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#626076 | #8239. Mysterious Tree | Albert711 | WA | 0ms | 3716kb | C++20 | 1.2kb | 2024-10-09 22:59:58 | 2024-10-09 22:59:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define ll long long
#define db double
const int mod=998244353;
const int N=2e5+5;
int ask(int x,int y){
int tmp;
cout<<"? "<<x<<" "<<y<<endl;
cin>>tmp;
return tmp;
}
void abt(){
int n;
cin>>n;
int t1,t2;
for(int i=1;i<=n;i+=2){
int tmp;
tmp=ask(i,i+1);
if(tmp==1){
t1=i;t2=i+1;
break;
}
}
if(n%2==1){
int tmp;
tmp=ask(1,n);
if(tmp==1){
t1=1;t2=n;
}
}
int t3,t4;
if(t1==1&&t2==n){
t3=2,t4=3;
}else if(t1>n/2){
t3=1,t4=2;
}else{
t3=n-1,t4=n;
}
int jud=0;
if(ask(t1,t3)){
if(ask(t1,t4)){
jud=1;
}
}else{
if(ask(t2,t3)){
if(ask(t2,t4)){
jud=1;
}
}
}
if(jud){
cout<<"! "<<2<<endl;
}else{
cout<<"! "<<1<<endl;
}
}
signed main(){
// ios::sync_with_stdio(false);
// cin.tie(nullptr);cout.tie(nullptr);
int T=1;
// cin>>T;
while(T--) abt();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3716kb
input:
2 4 1
output:
? 1 2 ? 1918690208 1 ? 1918690208 2
result:
wrong answer Integer 1918690208 violates the range [1, 4] (test case 1)