結果

問題 No.246 質問と回答
ユーザー otsnsk
提出日時 2015-10-13 14:42:27
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 63,884 KB
実行使用メモリ 25,220 KB
平均クエリ数 30.90
最終ジャッジ日時 2024-07-16 19:55:36
合計ジャッジ時間 3,770 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

#define FORR(i,b,e) for(int i=(b);i<(int)(e);++i)
#define FOR(i,e) FORR(i,0,e)
#define ALL(c) begin(c), end(c)
#define dump(var) cerr << #var ": " << var << "\n"
#define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n"

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int l = 1, r = 1e9+1, m;
    while (l + 1 < r) {
        m = (l + r) / 2;
        cout << "? " << m << endl;
        int a;
        cin >> a;
        if (a) l = m;
        else r = m;
    }
    
    cout << "! " << l << endl;

    return 0;
}
0