結果

問題 No.1187 皇帝ペンギン
ユーザー penguinman
提出日時 2020-08-08 16:53:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 1,000 ms
コード長 485 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 168,224 KB
実行使用メモリ 25,580 KB
平均クエリ数 19.81
最終ジャッジ日時 2024-07-17 05:38:39
合計ジャッジ時間 5,756 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using ll=long long;
using std::cin;
using std::cout;
using std::endl;
const ll max=1e3;
int main(){
    ll left=0,right=max-1;
    while(left+1<right){
        ll mid=(left+right)/2;
        cout<<"? "<<mid<<endl;
        std::string S,T;
        cin>>S;
        cout<<"? "<<mid+1<<endl;
        cin>>T;
        if(T=="safe") left=mid+1;
        else{
            if(S=="safe") left=mid;
            else right=mid;
        }
    }
    cout<<"! "<<left<<endl;
}
0