結果
問題 |
No.1187 皇帝ペンギン
|
ユーザー |
![]() |
提出日時 | 2020-08-22 13:22:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 1,000 ms |
コード長 | 539 bytes |
コンパイル時間 | 2,207 ms |
コンパイル使用メモリ | 193,880 KB |
最終ジャッジ日時 | 2025-01-13 07:30:16 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 54 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define modulo 998244353 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 2000000005 bool get(int m){ cout<<"? "<<m<<endl; string s; cin>>s; if(s=="safe")return true; return false; } int main(){ int ok = 0,ng = 1001; while(ng-ok>2){ int mid = (ok+ng)/2; if(get(mid+1)){ ok = mid+1; continue; } if(get(mid)){ ok = mid; continue; } ng = mid; } if(get(ok+1)){ cout<<"! "<<ok+1<<endl; } else cout<<"! "<<ok<<endl; return 0; }