Submission #357657

#TimeUsernameProblemLanguageResultExecution timeMemory
357657leinad2Colors (BOI20_colors)C++17
0 / 100
1 ms364 KiB
#include<bits/stdc++.h> using namespace std; long long n, a, b, m, prv, ans; int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n; prv=1; cout<<"? "<<prv<<endl; cin>>ans; a=1;b=n; while(a<b) { m=(a+b)/2; if(prv-m<1&&prv+m>n) { cout<<"? 1"<<endl; cin>>ans; prv=1; } if(prv-m>=1) { prv-=m; cout<<"? "<<prv<<endl; cin>>ans; if(ans==1)b=m; else a=m+1; } else { prv+=m; cout<<"? "<<prv<<endl; cin>>ans; if(ans==1)b=m; else a=m+1; } } cout<<"= "<<a<<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...