Submission #554834

#TimeUsernameProblemLanguageResultExecution timeMemory
554834kevinxiehkHotter Colder (IOI10_hottercolder)C++17
78 / 100
540 ms8136 KiB
#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 last = 1; int ans; // int Guess (int x) { // cout << x << '\n'; // if(abs(last - ans) == abs(x - ans)) return 0; // else if(abs(last - ans) > abs(x - ans)) return 1; // return -1; // } int HC(int n){ int l = 1, r = n; 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 == -1 && l == last)) { l = (l + r) / 2 + 1; } else { r = (l + r + 1) / 2 - 1; } } return l; } // int main() { // int n; // cin >> n >> ans; // cout << HC(n) << '\n'; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...