# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
680505 |
2023-01-11T02:17:33 Z |
jhwest2 |
Colors (BOI20_colors) |
C++17 |
|
0 ms |
208 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
bool ask(ll n) {
bool res;
cout << "? " << n << endl;
cin >> res;
return res;
}
int main() {
cin >> n;
ll L = 1, R = n;
ll x = n / 3, dir = 0;
ask(x);
while (L < R) {
ll M = (L + R + 1) / 2;
bool r;
if (dir == 0) {
r = ask(x + M);
x += M;
}
else {
r = ask(x - M);
x -= M;
}
dir = 1 - dir;
if (r)
R = M;
else
L = M + 1;
}
cout << "= " << L << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (3 queries) |
2 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (3 queries) |
2 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (3 queries) |
2 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (3 queries) |
2 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (3 queries) |
2 |
Runtime error |
0 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |