제출 #642267

#제출 시각아이디문제언어결과실행 시간메모리
642267KenparGuess the number (BOI20_guess)C++14
0 / 100
0 ms208 KiB
//Segment Tree Degil Bu What #include "bits/stdc++.h" using namespace std; #define ll long long const ll MOD = 1e9+7; const ll MAX = 2e5+1; void bSearch(int l, int r){ if(r>=l){ int mid = l + (r-l)/2; int ans; cout<<"? "<<mid<<'\n'; cout.flush(); cin>>ans; if(ans == 0){ cout<<"= "<<mid; return; }else if(ans == -1){ return bSearch(l, mid-1); } return bSearch(mid+1, r); }else{ //cout<<"Exception Occured, Wait what?"; } } void solve(){ int n; cin>>n; return bSearch(1,n); } int main() { int t = 1; //cin >> t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...