Submission #1096294

#TimeUsernameProblemLanguageResultExecution timeMemory
1096294laureColors (BOI20_colors)C++14
0 / 100
0 ms344 KiB
#include<bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; int l=1,r=n; int x; if(n==2) { cout<<"? 1"<<endl; cin>>x; cout<<"? 2"<<endl; cin>>x; if(x==0)cout<<"= 2"<<endl; else cout<<"= 1"<<endl; return 0; } int a,b; a=(1+n/2+1)/2; cout<<"? "<<a<<endl; cin>>x; while(l<r) { int mid=(l+r)/2; if(a==mid){mid--;l--;} if(a<mid)b=a+mid; else b=a-mid; a=b; cout<<"? "<<b<<endl; cin>>x; if(x==0) { l=mid+1; } else { r=mid; } } if(x==1)cout<<"= "<<l<<endl; else cout<<"= "<<r<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...