結果
問題 |
No.1187 皇帝ペンギン
|
ユーザー |
|
提出日時 | 2020-08-22 13:37:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 1,000 ms |
コード長 | 662 bytes |
コンパイル時間 | 532 ms |
コンパイル使用メモリ | 67,232 KB |
実行使用メモリ | 25,452 KB |
平均クエリ数 | 22.63 |
最終ジャッジ日時 | 2024-07-17 06:11:13 |
合計ジャッジ時間 | 4,649 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 54 |
ソースコード
#include <iostream> #include <string> using namespace std; string f(int v){ cout << "? " << v << endl; string res; cin >> res; return res; } int main(){ int L = 0, R = 1000; int query = 25; while(R-L > query){ int mid = (L+R)/2; auto s = f(mid); --query; if(s[0] == 's'){ L = mid; continue; } s = f(mid+1); --query; if(s[0] == 's'){ L = mid+1; } else { R = mid; } } for(int i=L+1;i<R;i++){ auto s = f(i); --query; if(s[0] == 's') L = i; } cout << "! " << L << endl; }