Submission #536334

#TimeUsernameProblemLanguageResultExecution timeMemory
536334skittles1412Colors (BOI20_colors)C++17
0 / 100
0 ms208 KiB
#include "bits/extc++.h" using namespace std; template <typename T> void dbgh(const T& t) { cerr << t << endl; } template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t << " | "; dbgh(u...); } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]" \ << ": "; \ dbgh(__VA_ARGS__) #else #define cerr \ if (false) \ cerr #define dbg(...) #endif #define endl "\n" #define long int64_t #define sz(x) int((x).size()) void solve() { int n; cin >> n; vector<int> vals; for (int i = 1; i <= n; i += 32) { vals.push_back(i); } vector<int> ord; int l = 0, r = sz(vals); while (l < r) { ord.push_back(vals[l++]); if (l < r) { ord.push_back(vals[--r]); } } reverse(begin(ord), end(ord)); for (auto& a : ord) { cout << "? " << a << endl; } int up = 0; for (int i = 0; i < sz(ord) - 1; i++) { int x; cin >> x; if (!x) { up = abs(ord[i + 1] - ord[i]); } } int prev = 1; bool b = true; for (int i = min(n - 1, up + 31); i > up; i--) { if (b) { prev += i; } else { prev -= i; } b ^= true; cout << "? " << prev << endl; int x; cin >> x; if (!x) { cout << "! " << i + 1 << endl; return; } } cout << up << endl; } int main() { ios_base::sync_with_stdio(false); cin.exceptions(ios::failbit); solve(); }
#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...