Submission #990563

#TimeUsernameProblemLanguageResultExecution timeMemory
990563alexddMađioničar (COI22_madionicar)C++17
100 / 100
1264 ms596 KiB
#include<bits/stdc++.h> using namespace std; int n,cntq; bool query(int le, int ri) { if(le<1 || ri>n || le>ri) return 0; if(le==ri) return 1; int aux; cout<<"? "<<le<<" "<<ri<<endl; cin>>aux; return aux; } signed main() { cin>>n; int mxm=1,p; for(int i=1;i<n;i++) { p = mxm/2; while(query(i-p,i+1+p)) p++; mxm = max(mxm, 2*p); } for(int i=1;i<=n;i++) { p = (mxm+1)/2; while(query(i-p,i+p)) p++; mxm = max(mxm, 2*p-1); } cout<<"! "<<mxm<<endl; 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...