結果

問題 No.1187 皇帝ペンギン
ユーザー umezo
提出日時 2020-08-27 16:19:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 1,000 ms
コード長 554 bytes
コンパイル時間 3,010 ms
コンパイル使用メモリ 192,680 KB
最終ジャッジ日時 2025-01-13 15:22:07
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  string s;
  int left=0,right=1001,mid;
  while(right-left>1){
    mid=(left+right)/2;
    cout<<"? "<<mid<<endl;
    cin>>s;
    if(s=="safe"){
      left=mid;
      continue;
    }
    cout<<"? "<<mid-1<<endl;
    cin>>s;
    if(s=="out"){
      right=mid;
      continue;
    }
    else{
      left=mid;
      continue;
    }
  }
  cout<<"! "<<max(left-1,0)<<endl;
  
  return 0;
}
0