結果
| 問題 | 
                            No.1187 皇帝ペンギン
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-08-22 15:36:03 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 411 bytes | 
| コンパイル時間 | 593 ms | 
| コンパイル使用メモリ | 65,976 KB | 
| 実行使用メモリ | 25,580 KB | 
| 平均クエリ数 | 21.24 | 
| 最終ジャッジ日時 | 2024-07-17 06:29:24 | 
| 合計ジャッジ時間 | 10,197 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 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;
}