Submission #881029

#TimeUsernameProblemLanguageResultExecution timeMemory
881029epicci23Mađioničar (COI22_madionicar)C++17
38 / 100
952 ms596 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; int ans=1,p=1; int lp=0; bool zipla=0; for(int i=2;i<=n;i++){ if(p>1 && ask(p-1,i)){ p--; lp=p; zipla=0; ans=max(ans,i-p+1); continue; } while(p<i && !ask(p,i)){ p++; if(zipla) {zipla=0;p=i;} } ans=max(ans,i-p+1); if(lp-p<=1) zipla=1; else zipla=0; lp=p; } 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...