結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
24,000 KB
testcase_01 AC 54 ms
24,000 KB
testcase_02 AC 55 ms
24,000 KB
testcase_03 AC 54 ms
24,000 KB
testcase_04 AC 54 ms
24,000 KB
testcase_05 AC 54 ms
24,000 KB
testcase_06 AC 54 ms
24,000 KB
testcase_07 AC 54 ms
24,000 KB
testcase_08 AC 54 ms
24,000 KB
testcase_09 AC 55 ms
24,000 KB
testcase_10 AC 54 ms
24,000 KB
testcase_11 AC 54 ms
24,000 KB
testcase_12 AC 55 ms
24,000 KB
testcase_13 AC 54 ms
24,000 KB
testcase_14 AC 71 ms
24,000 KB
testcase_15 AC 54 ms
24,000 KB
testcase_16 AC 55 ms
24,000 KB
testcase_17 AC 58 ms
24,000 KB
testcase_18 AC 66 ms
24,000 KB
testcase_19 AC 54 ms
24,000 KB
testcase_20 AC 54 ms
24,000 KB
testcase_21 AC 53 ms
24,000 KB
testcase_22 AC 53 ms
24,000 KB
testcase_23 AC 59 ms
24,000 KB
testcase_24 AC 59 ms
24,000 KB
testcase_25 AC 54 ms
24,000 KB
testcase_26 AC 54 ms
24,000 KB
testcase_27 AC 54 ms
24,000 KB
testcase_28 AC 56 ms
24,000 KB
testcase_29 AC 61 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 = 1 << 30, mid = (low + hi) / 2, q = -1, pq = -1;
    cout << "? " << mid << endl; 
    while (1){
        cin >> q;
        if (mid == low) break;
        else {
            if (q == 1) low = mid;
            else hi = mid;
            mid = (low + hi)/ 2;
            pq = q;
            cout << "? " << mid << endl;
        }
    }
    cout << "! " << low << endl;
}
0