# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
450401 | nonsensenonsense1 | Worm Worries (BOI18_worm) | C++17 | 1 ms | 200 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <cassert>
int n, m, k, q;
int query(int x)
{
printf("? %d 1 1\n", x);
fflush(stdout);
scanf("%d", &x);
return x;
}
int main()
{
scanf("%d%d%d%d", &n, &m, &k, &q);
int l = 1, r = n, x = -1, xval, y = -1, yval;
while (l < r) {
if (x == -1 || x < l || x >= (8 * l + 13 * r - 1) / 21 + 1) {
x = (13 * l + 8 * r) / 21;
xval = query(x);
}
if (y == -1 || y > r || y <= x) {
y = (8 * l + 13 * r - 1) / 21 + 1;
yval = query(y);
}
assert(x < y);
assert(x >= l);
assert(y <= r);
if (xval > yval) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |