結果

問題 No.1187 皇帝ペンギン
ユーザー firiexpfiriexp
提出日時 2020-11-27 17:51:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 797 bytes
コンパイル時間 964 ms
コンパイル使用メモリ 101,012 KB
実行使用メモリ 24,528 KB
平均クエリ数 26.56
最終ジャッジ日時 2023-09-24 07:19:33
合計ジャッジ時間 10,591 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 24 ms
23,412 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 25 ms
24,060 KB
testcase_06 AC 25 ms
23,676 KB
testcase_07 AC 24 ms
23,880 KB
testcase_08 AC 25 ms
23,352 KB
testcase_09 WA -
testcase_10 AC 25 ms
23,460 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 25 ms
23,676 KB
testcase_20 AC 25 ms
23,772 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 25 ms
23,592 KB
testcase_26 WA -
testcase_27 AC 26 ms
23,748 KB
testcase_28 WA -
testcase_29 AC 25 ms
23,436 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 24 ms
24,360 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int ask(int x){
    cout << "? " << x << endl;
    string ret;
    cin >> ret;
    return ret == "safe";
}

void answer(int x){
    cout << "! " << x << endl;
    exit(0);
}

int main() {
    int ok = 0, ng = 10010;
    while(ng-ok > 1){
        int mid = (ok+ng)/2;
        int ret1 = ask(mid), ret2 = ask(mid+1);
        if(!ret1 && !ret2) ng = mid;
        else ok = (ret2 ? mid+1 : mid);
    }
    answer(ok);
    return 0;
}
0