# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
686640 |
2023-01-25T15:47:32 Z |
null_awe |
Colors (BOI20_colors) |
C++14 |
|
1 ms |
208 KB |
#include <iostream>
#include <set>
using namespace std;
#define int long long
int n, at;
set<int> s;
bool qry(int x) {
if (at + x <= n) at += x;
else at -= x;
if (s.count(at)) exit(0);
cout << "? " << at << endl;
s.insert(at);
bool ans; cin >> ans;
return ans;
}
int32_t main() {
cin >> n;
bool added = true;
int left = n;
at = 1;
for (int i = (left + 1) / 2; i > 0; left >>= 1, i = (left + 1) / 2) {
if (!added) at += i;
added = !added;
if (i == 1) break;
}
cout << "? " << at << endl;
int tmp; cin >> tmp;
s.insert(at);
int sum = 0;
left = n;
for (int i = (left + 1) / 2; i > 0; left >>= 1, i = (left + 1) / 2) {
int chg = sum + i;
if (chg >= n) continue;
if (!qry(chg)) sum = chg;
}
cout << "= " << sum + 1 << '\n';
return 0;
}
/*
49
25
12
6
3
2
1
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (7 queries) |
3 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (7 queries) |
3 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (7 queries) |
3 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (7 queries) |
3 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
208 KB |
OK (7 queries) |
3 |
Incorrect |
1 ms |
208 KB |
Unexpected end of file - token expected |
4 |
Halted |
0 ms |
0 KB |
- |