Submission #685111

#TimeUsernameProblemLanguageResultExecution timeMemory
685111stanislavpolynColors (BOI20_colors)C++17
9 / 100
2 ms304 KiB
#include <bits/stdc++.h> #define fr(i, a, b) for (int i = (a); i <= (b); ++i) #define rf(i, a, b) for (int i = (a); i >= (b); --i) #define fe(x, y) for (auto& x : y) #define fi first #define se second #define pb push_back #define mp make_pair #define mt make_tuple #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define pw(x) (1LL << (x)) using namespace std; mt19937_64 rng(228); #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define fbo find_by_order #define ook order_of_key template <typename T> bool umx(T& a, T b) { return a < b ? a = b, 1 : 0; } template <typename T> bool umn(T& a, T b) { return a > b ? a = b, 1 : 0; } using ll = long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; template <typename T> using ve = vector<T>; #ifdef LOCAL const bool DEBUG = 1; #else const bool DEBUG = 0; #endif ll n, C; set<ll> used; ll last; bool ask(ll x) { assert(!used.count(x)); used.insert(x); cout << "? " << x << "\n" << flush; if (DEBUG) { if (abs(x - last) >= C) { last = x; return 1; } else { last = x; return 0; } } last = x; int val; cin >> val; return val; } int main() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #else // ios::sync_with_stdio(0); // cin.tie(0); #endif cin >> n; if (DEBUG) { cin >> C; } ask(1); bool who = 0; rf (now, n - 1, 1) { if (who == 0) { if (!ask(last + now)) { cout << "= " << now + 1 << "\n"; return 0; } } else { if (!ask(last - now)) { cout << "= " << now + 1 << "\n"; return 0; } } who ^= 1; } cout << "= " << 1 << "\n"; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...