# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
554830 | kevinxiehk | Hotter Colder (IOI10_hottercolder) | C++17 | 0 ms | 0 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"
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
using namespace std;
int Guess (int x);
int HC(int n){
int l = 1, r = n;
int last = 1;
Guess(1);
while(l < r) {
if(last != l && last != r) {
Guess(l); last = l;
}
int k = guess(l ^ r ^ last);
last = l ^ r ^ last;
if(k == 0) {
return (l + r) / 2;
}
else if((k == 1 && r == last) || (k == 0 && l == last)) {
l = (l + r) / 2 + 1;
}
else {
r = (l + r + 1) / 2 - 1;
}
}
return l;
}