답안 #868740

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
868740 2023-11-01T20:39:23 Z Dec0Dedd Guess the number (BOI20_guess) C++14
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

int ask(int x) {
    cout<<"? "<<x<<endl;
    int r; cin>>r;
    return r;
}

int main() {
    int n; cin>>n;

    int l=1, r=n;
    while (l <= r) {
        int m=(l+r)/2;

        int k=ask(m);
        if (k == -1) r=m-1;
        else if (k == 1) l=m+1;
        else {
            cout<<"= "<<m<<endl;
            return 0;
        }
    } assert(false);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -