Submission #800368

#TimeUsernameProblemLanguageResultExecution timeMemory
800368PagodePaivaMađioničar (COI22_madionicar)C++14
100 / 100
1402 ms336 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int res = 1; int l = 1, r = 3; while(r <= n){ cout << "? " << l << " " << r << "\n"; cout << flush; int x; cin >> x; if(x == 1){ res = r-l+1; if(l == 1) r += 2; else{ l--; r++; } } else{ l++; r++; } } l = 1; r = res+1; while(r <= n){ cout << "? " << l << " " << r << "\n"; cout << flush; int x; cin >> x; if(x == 1){ res = r-l+1; if(l == 1) r += 2; else{ l--; r++; } } else{ l++; r++; } } cout << "! " << res << "\n"; cout << flush; 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...