結果

問題 No.1187 皇帝ペンギン
コンテスト
ユーザー ふやけももんが
提出日時 2025-12-16 16:05:57
言語 C++17
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 38 ms / 1,000 ms
コード長 994 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,751 ms
コンパイル使用メモリ 195,740 KB
実行使用メモリ 26,368 KB
平均クエリ数 16.48
最終ジャッジ日時 2025-12-16 16:06:04
合計ジャッジ時間 6,854 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;

class judge{

    public:
        int angry = 385;
        int mod = 17;

        string query(int x){
            if( x < angry && x%mod != 0){
                return "safe";
            }
            else{
                return "out";
            }
        }
};

int main(){
   int ok = 0,ng = 1000;
    //judge jud;
    
    while(ok != ng-1){
        //cout << "in" << endl;
        int check = (ok+ng)/2;
        cout<< "? " << check << endl;
        string answer;
        cin >> answer;
        //answer = jud.query(check);
        if(answer == "safe"){
            ok = check;
            continue;
        }
        else{
            cout << "? " << check+1 << endl;
            string ans;
            cin >> ans;
            //ans = jud.query(check+1);
            if(ans == "safe"){
                ok = check+1;
            }
            else{
                ng = check;
            }
        }
    }

    cout << "! "<<ok << endl;
}
0