# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
394306 |
2021-04-26T11:31:13 Z |
KoD |
Colors (BOI20_colors) |
C++17 |
|
1 ms |
200 KB |
#include <bits/stdc++.h>
using ll = long long;
bool ask(const ll x) {
std::cout << "? " << x << std::endl;
bool f;
std::cin >> f;
return f;
}
int main() {
ll N;
std::cin >> N;
assert(N <= 125);
ll half = (N - 1) / 2;
ll other = (N - 1) - half;
ll pos = 1 + (other + 1) / 2;
ask(pos);
pos += half;
if (ask(pos)) {
ll len = half;
ll dir = -1;
while (--len > 0) {
pos += dir * len;
dir *= 1;
if (!ask(pos)) {
break;
}
}
std::cout << len + 1 << '\n';
}
else {
ll len = half;
ll dir = -1;
while (++len < N) {
pos += dir * len;
dir *= -1;
if (ask(pos)) {
break;
}
}
std::cout << len << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Token parameter [name=cmd] equals to "4", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |