結果

問題 No.1187 皇帝ペンギン
ユーザー e869120
提出日時 2021-03-05 18:01:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 639 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 83,912 KB
実行使用メモリ 25,464 KB
平均クエリ数 25.00
最終ジャッジ日時 2024-07-17 10:38:48
合計ジャッジ時間 4,929 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int main() {
	int cl = 1, cr = 1005, cm, maxn = 0;
	for (int i = 0; i < 12; i++) {
		cm = (cl + cr) / 2;
		cout << "? " << cm + 0 << endl; string t1; cin >> t1;
		cout << "? " << cm + 1 << endl; string t2; cin >> t2;
		if (t1 == "safe") maxn = max(maxn, cm + 0);
		if (t2 == "safe") maxn = max(maxn, cm + 1);
		if (t1 == "out" && t2 == "out") { cr = cm; }
		else { cl = cm; }
	}
	cout << "! " << maxn << endl;
	return 0;
}
0