結果

問題 No.1187 皇帝ペンギン
ユーザー chocorusk
提出日時 2020-08-22 15:26:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 988 bytes
コンパイル時間 2,190 ms
コンパイル使用メモリ 123,440 KB
最終ジャッジ日時 2025-01-13 09:34:38
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26 RE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int l=0, r=1000;
    int cnt=0;
    while(r-l>1){
        int m=(l+r)/2;
        assert(cnt<25);
        cout<<"? "<<m<<endl;
        cnt++;
        string res; cin>>res;
        if(res=="safe"){
            l=m;
            continue;
        }
        assert(cnt<25);
        cout<<"? "<<m-1<<endl;
        cnt++;
        cin>>res;
        if(res=="safe") l=m-1;
        else r=m-1;
    }
    cout<<"! "<<l<<endl;
    return 0;
}
0