結果
問題 |
No.1187 皇帝ペンギン
|
ユーザー |
|
提出日時 | 2022-10-03 21:00:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 1,000 ms |
コード長 | 681 bytes |
コンパイル時間 | 2,092 ms |
コンパイル使用メモリ | 193,248 KB |
最終ジャッジ日時 | 2025-02-07 20:55:21 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 54 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); auto f = [&](int x) { cout << "?" << " " << x << endl; cout.flush(); string s; cin >> s; return (s == "out"); }; int ok = -1, ng = 1000 + 1; while(ng - ok > 1) { int mid = (ok + ng) / 2; bool f0 = f(mid), f1 = f(mid + 1); if(f0 && f1) { ng = mid; } else if(!f1) { ok = mid + 1; } else if(!f0) { ok = mid; } } cout << "!" << " " << ok << endl; cout.flush(); }