Submission #895202

#TimeUsernameProblemLanguageResultExecution timeMemory
895202IrateHotter Colder (IOI10_hottercolder)C++14
0 / 100
481 ms47848 KiB
#include<bits/stdc++.h> using namespace std; int Guess(int n); // int Guess(int n){ // // cout << "? " << n << ": "; // int num; // cin >> num; // return num; // } int HC(int n){ int l = 1, r = n, last = 1; Guess(1); while(l < r){ int mid = (l + r) >> 1; // cout << l << ", " << r << ": " << last << '\n'; if(last == l){ int num = Guess(r); if(num == -1){ r = mid - 1; last = r; Guess(r); } else if(num == 1){ l = mid + 1; last = l; Guess(l); } else{ return (l + r) >> 1; } } else{ int num = Guess(l); if(num == 1){ r = mid - 1; last = r; Guess(r); } else if(num == -1){ l = mid + 1; last = l; Guess(l); } else return (l + r) >> 1; } } return l; } // int main(){ // int n, X; // cin >> n >> X; // cout << HC(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...