Submission #881010

#TimeUsernameProblemLanguageResultExecution timeMemory
881010epicci23Mađioničar (COI22_madionicar)C++17
0 / 100
987 ms432 KiB
#include "bits/stdc++.h" using namespace std; #define int long long #define pb push_back #define all(x) ((x).begin(),(x).end()) #define sz(x) ((int)(x).size()) bool ask(int l,int r){ cout << "? " << l << " " << r << endl; bool ans; cin >> ans; return ans; } void solve(){ int n; cin >> n; for(int i=1;i<200005;i++) ask(1,n); int ans=1,p=1; for(int i=2;i<=n;i++){ if(p>1 && ask(p-1,i)){ p--; ans=max(ans,i-p+1); continue; } while(p<i && !ask(p,i)) p++; ans=max(ans,i-p+1); } cout << "! " << ans << endl; } int32_t main(){ ios::sync_with_stdio(0);cin.tie(0); int t=1;//cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...