Submission #880916

#TimeUsernameProblemLanguageResultExecution timeMemory
880916epicci23Mađioničar (COI22_madionicar)C++17
38 / 100
1020 ms596 KiB
#include "bits/stdc++.h" using namespace std; #define int long long #define endl '\n' #define pb push_back #define all(x) ((x).begin(),(x).end()) #define sz(x) ((int)(x).size()) int ask(int l,int r){ cout << "? " << l << " " << r << endl << flush; int ans; cin >> ans; return ans; } void solve(){ int n; cin >> n; int ans=1; int p = 1; for(int i=2;i<=n;i++){ if(p>=2 && ask(p-1,i)){ p--; ans=max(ans,i-p+1); continue; } while(p<i && ask(p,i)==0) p++; ans=max(ans,i-p+1); } cout << "! " << ans << endl << flush; } 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...