# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
554830 | 2022-04-29T13:28:16 Z | kevinxiehk | Hotter Colder (IOI10_hottercolder) | C++17 | 0 ms | 0 KB |
#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; }