結果

問題 No.1187 皇帝ペンギン
ユーザー tonyu0
提出日時 2020-08-22 16:46:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 712 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 104,216 KB
最終ジャッジ日時 2025-01-13 10:24:55
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#define rep(i, j, n) for (int i = (j); i < (n); ++i)
using namespace std;
using ll = long long;

int main() {
  string s, t;
  int l = -1, r = 1010;
  while (true) {
    int mid = (l + r) >> 1;
    cout << "? " << mid << endl;
    cin >> s;
    cout << "? " << mid + 1 << endl;
    cin >> t;
    if (s == "out" && t == "out") {
      r = mid;
    } else if (s == "safe" && t == "out") {
      cout << "! " << mid << endl;
      break;
    } else if (s == "out" && t == "safe") {
      cout << "! " << mid + 1 << endl;
      break;
    } else {
      l = mid;
    }
  }
  return 0;
}
0