Submission #970302

#TimeUsernameProblemLanguageResultExecution timeMemory
970302maxFedorchukColors (BOI20_colors)C++17
100 / 100
2 ms756 KiB
#include <bits/stdc++.h> using namespace std; long long zap(long long zn) { cout<<"? "<<zn<<endl; cout.flush(); int rt; cin>>rt; return rt; } void ans(long long zn) { cout<<"= "<<zn<<endl; cout.flush(); } int main() { cin.tie(0); ios_base::sync_with_stdio(0); long long n; cin>>n; long long start=0,zr=0,l=1,r=n,o=-1; while(l<r) { l=(l+r-1)/2; zr+=o*l; start=max(start,1ll-zr); l++; o*=-1; } zap(start); l=1,r=n,o=-1; while(l<r) { long long mid=(l+r-1)/2; start+=mid*o; if(zap(start)) { r=mid; } else { l=mid+1; } o*=-1; } ans(l); return 0; }
#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...