結果
問題 |
No.1187 皇帝ペンギン
|
ユーザー |
![]() |
提出日時 | 2020-08-27 16:19:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 685 bytes |
コンパイル時間 | 2,359 ms |
コンパイル使用メモリ | 195,032 KB |
最終ジャッジ日時 | 2025-01-13 15:21:53 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 54 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; int n,d; string f(int i){ if(i<n && i%d!=0) return "safe"; else return "out"; } int main(){ cin>>n>>d; string s; int left=0,right=1001,mid; while(right-left>1){ mid=(left+right)/2; cout<<"? "<<mid<<endl; s=f(mid); cin>>s; if(s=="safe"){ left=mid; continue; } cout<<"? "<<mid-1<<endl; s=f(mid-1); cin>>s; if(s=="out"){ right=mid; continue; } else{ left=mid; continue; } } cout<<"! "<<max(left-1,0)<<endl; return 0; }