Submission #642320

# Submission time Handle Problem Language Result Execution time Memory
642320 2022-09-19T08:35:02 Z Erennedirlo Guess the number (BOI20_guess) C++17
0 / 100
1 ms 208 KB
#include<iostream>
using namespace std;

int main(){
  int N;
  cin>>N;
  N+=1;

  int left=1, right=N;

  while(1){
    int tmp=(right-left)/2+left;
    int ans;
    cout<<"?"<<" "<<tmp;
    cout.flush();
    cin>>ans;
    if(ans==-1){
      right=tmp;
    }
    else if(ans==0){
      cout<<"= "<<tmp;
      break;
    }
    else{
      left=tmp;
    }
  }

  return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -