Submission #779393

#TimeUsernameProblemLanguageResultExecution timeMemory
779393groshiMađioničar (COI22_madionicar)C++17
38 / 100
1354 ms1492 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int R[2][200000]; int32_t main() { //cin.tie(0); //cout.tie(0); //ios_base::sync_with_stdio(0); int n; cin>>n; int maxx=0; for(int j=0;j<=1;j++) { R[j][0]=0; int rp=0; int i=1; while(i<=n) { while(i-rp-1>=1 && i+j+rp<=n) { cout<<"? "<<i-rp-1<<" "<<i+j+rp<<"\n"; int co; cin>>co; if(co==1) rp++; else break; } R[j][i]=rp; int k=1; while((R[j][i-k]!=rp-k)&&(k<rp)) { R[j][i+k]=min(R[j][i-k],rp-k); k++; } rp=max(rp-k,0LL); i+=k; } } for(int i=0;i<=1;i++) for(int j=0;j<=n;j++) maxx=max(maxx,R[i][j]*2+i); cout<<"! "<<maxx; 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...