# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
533096 | 2022-03-04T18:25:49 Z | kabika | Colors (BOI20_colors) | C++17 | 1 ms | 200 KB |
#include <iostream> #include <vector> #include <algorithm> #include <math.h> using namespace std; typedef long long ll; constexpr ll INF = 1e18; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; vector<bool> vis(n + 1, 0); cout << "? 1\n"; vis[1] = 1; bool resp; cin >> resp; bool flag = 1; ll l = 1, u = n; ll diff = (l + u) / 2; ll qr = l + diff; while (l < u) { cout << "? " << qr << endl; vis[qr] = 1; cin >> resp; if (resp) { u = diff; } else { l = diff + 1; } diff = (l + u) / 2; if (qr - diff >= 1 && !vis[qr - diff]) { qr -= diff; continue; } if (qr + diff <= n && !vis[qr + diff]) { qr += diff; continue; } break; } cout << "= " << l << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1 ms | 200 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1 ms | 200 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1 ms | 200 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1 ms | 200 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1 ms | 200 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |