# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
173047 | gs13068 | Hotter Colder (IOI10_hottercolder) | C++17 | 895 ms | 8172 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 "grader.h"
#include <cmath>
int cal(int n) {
return n < 5 ? 1 : (n + 1 >> 1) - cal(n >> 1);
}
int HC(int N){
int L = 1, R = N, prv, nxt, t, W = log(3 * N) / log(2);
while (L < R) {
if (R == 2) {
Guess(1);
return Guess(2) < 0 ? 1 : 2;
}
int cut = W & 1 ? (2 << W - 2) / 3 + 1 : (2 << W - 2) / 3 + 2;
nxt = R == N ? cut + cal(R - cut) : cut + cut - 1;
prv = cut + cut - nxt;
Guess(prv);
t = Guess(nxt);
if (t == -1) R = prv + nxt - 1 >> 1;
if (t == 0) return prv + nxt >> 1;
if (t == 1) {
L = prv + nxt + 2 >> 1;
prv = nxt;
while (L < R) {
nxt = (L + R >> 1 << 1) - prv;
if (nxt == prv) nxt++;
if (nxt < 1) nxt = 1;
if (nxt > N) nxt = N;
t = Guess(nxt);
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... |