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