Submission #748609

#TimeUsernameProblemLanguageResultExecution timeMemory
748609mariowongMađioničar (COI22_madionicar)C++14
100 / 100
1944 ms336 KiB
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); int n; cin >> n; int sz=2; for (int i=1;i<=n;i++){ int x=1; while (x){ int l=i-sz/2+1,r=i+sz/2; if (l > 0 && r <= n){ cout << "? " << l << " " << r << endl; cin >> x; if (x) sz+=2; } else x=0; } } int sz2=3; for (int i=1;i<=n;i++){ int x=1; while (x){ int l=i-sz2/2,r=i+sz2/2; if (l > 0 && r <= n){ cout << "? " << l << " " << r << endl; cin >> x; if (x) sz2+=2; } else x=0; } } cout << "! " << max(sz,sz2)-2 << "\n"; return 0; } //0 1 1 2 2 3 1 //2 4 1 2 2 5 1
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...