# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
232365 | crossing0ver | Hotter Colder (IOI10_hottercolder) | C++17 | 789 ms | 8184 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<bits/stdc++.h>
#include "grader.h"
using namespace std;
int HC(int N){
if (N == 1) return 1;
int m = N/2;
Guess(N);
int ask,last = N;
int l = 1, r = N;
int x = m;
ask = Guess(x);
while (l != r)
{
if (ask == 0) {
return (last + x)/2;
}
if (ask == 1) {
if (last < x)
l = max(l,(last + x)/2 + 1);
else r = min(r,(x + last - 1)/2);
}
else {
if (last < x)
r = min(r,(last + x - 1)/2);
else l = max(l,(x + last)/2 + 1);
}
if (l == r) return l;
last = x;
x = (l + r - last + 1)/2;
if (x < l) x = (l + r)/2;
if (x == last ) x++;
ask = Guess(x);
}
}
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... |