Submission #824688

#TimeUsernameProblemLanguageResultExecution timeMemory
824688ThylOneGuess the number (BOI20_guess)C++14
100 / 100
1 ms300 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int N;cin>>N; int inf = 1; int sup = N; while(inf<sup){ int mid((inf+sup)/2); cout<<"? "<<mid<<endl; int P;cin>>P; if(P==-1){ //right inf = mid+1; }else if(P==1){ sup=mid-1; }else{ cout<<"= "<<mid<<endl; return 0; } } cout<<"= "<<inf<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...