結果

問題 No.246 質問と回答
ユーザー kpinkcatkpinkcat
提出日時 2023-11-09 04:33:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 1,164 ms
コンパイル使用メモリ 103,952 KB
実行使用メモリ 24,000 KB
平均クエリ数 31.90
最終ジャッジ日時 2023-11-09 04:33:41
合計ジャッジ時間 5,163 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
24,000 KB
testcase_01 AC 62 ms
24,000 KB
testcase_02 AC 58 ms
24,000 KB
testcase_03 AC 58 ms
24,000 KB
testcase_04 AC 59 ms
24,000 KB
testcase_05 AC 59 ms
24,000 KB
testcase_06 AC 55 ms
24,000 KB
testcase_07 AC 63 ms
24,000 KB
testcase_08 AC 57 ms
24,000 KB
testcase_09 AC 59 ms
24,000 KB
testcase_10 AC 62 ms
24,000 KB
testcase_11 AC 57 ms
24,000 KB
testcase_12 AC 62 ms
24,000 KB
testcase_13 AC 56 ms
24,000 KB
testcase_14 AC 60 ms
24,000 KB
testcase_15 AC 60 ms
24,000 KB
testcase_16 AC 62 ms
24,000 KB
testcase_17 AC 55 ms
24,000 KB
testcase_18 AC 59 ms
24,000 KB
testcase_19 AC 62 ms
24,000 KB
testcase_20 AC 57 ms
24,000 KB
testcase_21 AC 58 ms
24,000 KB
testcase_22 AC 57 ms
24,000 KB
testcase_23 AC 60 ms
24,000 KB
testcase_24 AC 61 ms
24,000 KB
testcase_25 AC 62 ms
24,000 KB
testcase_26 AC 61 ms
24,000 KB
testcase_27 AC 57 ms
24,000 KB
testcase_28 AC 59 ms
24,000 KB
testcase_29 AC 57 ms
24,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

int main(){
    int low = 1, hi = 1e9+1, mid = (low + hi) / 2, q = -1, pq = -1;
    cout << "? " << mid << endl; 
    while (mid != low){
        cin >> q;
        if (q == 1) low = mid;
        else hi = mid;
        mid = (low + hi)/ 2;
        pq = q;
        cout << "? " << mid << endl;
    }
    cout << "! " << low << endl;
}
0