Submission #959893

#TimeUsernameProblemLanguageResultExecution timeMemory
959893pccMađioničar (COI22_madionicar)C++17
13 / 100
1109 ms596 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,popcnt,sse4") #define pii pair<int,int> #define fs first #define sc second #define ll long long int N; bool check(int len){ if(len<=1)return true; for(int i = 1;i+len-1<=N;i++){ cout<<"? "<<i<<' '<<i+len-1<<endl; int re; cin>>re; if(re)return true; } return false; } int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>N; int l = 0,r = N>>1; while(l != r){ int mid = (l+r+1)>>1; if(check(mid*2))l = mid; else r = mid-1; } int ans = l*2; l = 1,r = (N+1)>>1; while(l != r){ int mid = (l+r+1)>>1; if(check(mid*2-1))l = mid; else r = mid-1; } ans = max(ans,r*2-1); cout<<"! "<<ans<<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...