結果
問題 | No.1187 皇帝ペンギン |
ユーザー |
|
提出日時 | 2020-08-22 16:56:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 1,000 ms |
コード長 | 821 bytes |
コンパイル時間 | 1,028 ms |
コンパイル使用メモリ | 103,264 KB |
最終ジャッジ日時 | 2025-01-13 10:31:40 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 54 |
ソースコード
#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 (r - l > 1) { 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") { l = mid; } else if (s == "out" && t == "safe") { l = mid; } else { l = mid; } } cout << "? " << l << endl; cin >> s; cout << "? " << l + 1 << endl; cin >> t; if (t == "safe") cout << "! " << l + 1 << endl; else cout << "! " << l << endl; return 0; }