結果
| 問題 |
No.1187 皇帝ペンギン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 15:36:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 1,000 ms |
| コード長 | 417 bytes |
| コンパイル時間 | 740 ms |
| コンパイル使用メモリ | 64,724 KB |
| 実行使用メモリ | 25,324 KB |
| 平均クエリ数 | 21.24 |
| 最終ジャッジ日時 | 2024-07-17 06:28:27 |
| 合計ジャッジ時間 | 4,780 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 54 |
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
main()
{
int L=0,R=1000;
while(R-L>2)
{
int M=(L+R)/2;
string a,b;
cout<<"? "<<M<<endl;
cin>>a;
cout<<"? "<<M+1<<endl;
cin>>b;
if(a=="out"&&b=="out")R=M+1;
else if(a=="out"&&b=="safe")L=M+1;
else if(a=="safe"&&b=="out")L=M;
else L=M+1;
}
while(true)
{
cout<<"? "<<L+1<<endl;
string a;cin>>a;
if(a=="out")break;
L++;
}
cout<<"! "<<L<<endl;
}