Submission #1040837

#TimeUsernameProblemLanguageResultExecution timeMemory
104083712345678Colors (BOI20_colors)C++17
0 / 100
1 ms436 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, tmp; int query(ll x) { cout<<"? "<<x<<endl; cin>>tmp; return tmp; } int main() { cin>>n; ll dir=1, st=1, cur=1, l=1, r=n; while (l<r) { ll md=(l+r)/2; if (cur+dir*md>=1) cur+=dir*md; else st+=1-(cur+dir*md), cur=1; l=md+1; dir=-dir; } query(st); cur=st, dir=1, l=1, r=n; while (l<r) { ll md=(l+r)/2; cur+=dir*md; if (query(cur)) r=md; else l=md+1; dir=-dir; } cout<<"= "<<l<<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...