Submission #850629

#TimeUsernameProblemLanguageResultExecution timeMemory
850629CyanmondMađioničar (COI22_madionicar)C++17
100 / 100
1132 ms2516 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, l, r) for (int i = (l); i < (r); ++i) #define per(i, l, r) for (int i = (r - 1); i >= l; --i) #define ALL(x) (x).begin(), (x).end() using i64 = long long; void main_() { int N; cin >> N; vector<pair<int, int>> s; rep(i, 0, N) s.push_back({i, i}); rep(i, 0, N - 1) s.push_back({i, i + 1}); sort(ALL(s), [&](const auto a, const auto b) { int x = 2 * min(a.first, N - a.second - 1); if (a.first != a.second) ++x; int y = 2 * min(b.first, N - b.second - 1); if (b.first != b.second) ++y; return x < y; }); reverse(ALL(s)); int ans = 1; for (const auto &[a, b] : s) { int x = 2 * min(a, N - b - 1) + 2; if (a == b) --x; if (x < ans + 1) continue; while (true) { if (x < ans + 1) break; int p = ans + 1; if (x % 2 != p % 2) ++p; if (p > x) break; cout << '?'; int u = (p - 1) / 2; cout << ' ' << a - u + 1 << ' ' << b + u + 1 << endl; int res; cin >> res; if (res == 1) ans = p; else break; } } cout << '!' << ' ' << ans << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); main_(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...