# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
357716 | 2021-01-24T13:36:40 Z | mjhmjh1104 | Colors (BOI20_colors) | C++14 | 1 ms | 384 KB |
#include <cstdio> #include <vector> #include <algorithm> using namespace std; vector<long long> v; long long n; int t; int main() { scanf("%lld", &n); long long curr = 1; long long l = n / 2, r = n - 1; while (l < r) { v.push_back(l); l = (l + r) / 2 + 1; } v.push_back(l); reverse(v.begin(), v.end()); for (auto &i: v) { if (curr + i <= n) curr += i; else curr -= i; } printf("? %lld\n", curr); fflush(stdout); scanf("%*d"); l = 0, r = n - 1; while (l < r) { long long m = (l + r) / 2; if (curr + m <= n) curr += m; else curr -= m; printf("? %lld\n", curr); fflush(stdout); scanf("%d", &t); if (t) r = m; else l = m + 1; } if (l == n - 1) { printf("? %lld\n", n); fflush(stdout); scanf("%d", &t); if (t) printf("= %lld\n", n - 1); else printf("= %lld\n", n); } else printf("= %lld\n", l); fflush(stdout); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (4 queries) |
2 | Correct | 0 ms | 256 KB | OK (6 queries) |
3 | Correct | 0 ms | 256 KB | OK (4 queries) |
4 | Incorrect | 1 ms | 256 KB | Hair color 20 was used multiple times |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (4 queries) |
2 | Correct | 0 ms | 256 KB | OK (6 queries) |
3 | Correct | 0 ms | 256 KB | OK (4 queries) |
4 | Incorrect | 1 ms | 256 KB | Hair color 20 was used multiple times |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (4 queries) |
2 | Correct | 0 ms | 256 KB | OK (6 queries) |
3 | Correct | 0 ms | 256 KB | OK (4 queries) |
4 | Incorrect | 1 ms | 256 KB | Hair color 20 was used multiple times |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (4 queries) |
2 | Correct | 0 ms | 256 KB | OK (6 queries) |
3 | Correct | 0 ms | 256 KB | OK (4 queries) |
4 | Incorrect | 1 ms | 256 KB | Hair color 20 was used multiple times |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | OK (4 queries) |
2 | Correct | 0 ms | 256 KB | OK (6 queries) |
3 | Correct | 0 ms | 256 KB | OK (4 queries) |
4 | Incorrect | 1 ms | 256 KB | Hair color 20 was used multiple times |
5 | Halted | 0 ms | 0 KB | - |