結果
| 問題 | 
                            No.1187 皇帝ペンギン
                             | 
                    
| コンテスト | |
| ユーザー | 
                             penguinman
                         | 
                    
| 提出日時 | 2020-08-01 01:02:47 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 627 bytes | 
| コンパイル時間 | 1,626 ms | 
| コンパイル使用メモリ | 168,296 KB | 
| 実行使用メモリ | 25,692 KB | 
| 平均クエリ数 | 19.83 | 
| 最終ジャッジ日時 | 2024-07-17 04:08:16 | 
| 合計ジャッジ時間 | 9,179 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 WA * 34 | 
ソースコード
#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<<endl;
        cin>>T;
        if(T=="safe") left=mid+1;
        else{
            if(S=="safe") left=mid;
            else right=mid-1;
        }
    }
    ll ans=0;
    for(int i=left;i<=right;i++){
        cout<<"? "<<i<<endl;
        std::string S; cin>>S;
        if(S=="safe") ans=i;
    }
    cout<<"! "<<ans<<endl;
}
            
            
            
        
            
penguinman