結果

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

ソースコード

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)
#define rrep(i, j, n) for (int i = (n)-1; i >= (j); --i)
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 998244353;

int main() {
  string s, t;
  int l = 0, r = 2000;
  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;
    } else if (s == "out" && t == "safe") {
      cout << "! " << mid + 1 << endl;
    } else {
      l = mid + 1;
    }
  }
  return 0;
}
0