# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1014727 | 2024-07-05T10:57:51 Z | idioti11 | Library (JOI18_library) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; int query(int a, int b) { cout << "? " << a << " " << b << endl; int result; cin >> result; return result; } int main() { int n; cin >> n; vector<int> sizes(n + 1, 0); int l = 1, r = n; while (l < r) { int mid = (l + r) / 2; int max1 = query(l, mid); int max2 = query(mid + 1, r); if (max1 < max2) { l = mid + 1; } else { r = mid; } } cout << "! " << l << endl; return 0; }