結果

問題 No.1187 皇帝ペンギン
ユーザー ffffff
提出日時 2020-08-22 13:56:08
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 2,003 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 88,236 KB
実行使用メモリ 24,300 KB
平均クエリ数 16.44
最終ジャッジ日時 2023-09-24 05:57:58
合計ジャッジ時間 4,966 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,292 KB
testcase_01 AC 25 ms
23,736 KB
testcase_02 AC 25 ms
24,024 KB
testcase_03 AC 25 ms
23,424 KB
testcase_04 AC 24 ms
23,664 KB
testcase_05 AC 25 ms
23,544 KB
testcase_06 AC 25 ms
23,916 KB
testcase_07 AC 25 ms
23,424 KB
testcase_08 AC 26 ms
24,264 KB
testcase_09 AC 25 ms
23,376 KB
testcase_10 AC 24 ms
23,928 KB
testcase_11 AC 26 ms
23,424 KB
testcase_12 AC 26 ms
23,532 KB
testcase_13 AC 26 ms
23,508 KB
testcase_14 AC 25 ms
24,024 KB
testcase_15 AC 25 ms
23,412 KB
testcase_16 AC 25 ms
23,832 KB
testcase_17 AC 24 ms
23,676 KB
testcase_18 AC 25 ms
24,288 KB
testcase_19 AC 26 ms
23,532 KB
testcase_20 AC 25 ms
23,952 KB
testcase_21 AC 25 ms
23,640 KB
testcase_22 AC 25 ms
23,304 KB
testcase_23 AC 25 ms
24,276 KB
testcase_24 AC 25 ms
24,264 KB
testcase_25 AC 25 ms
23,520 KB
testcase_26 AC 26 ms
23,520 KB
testcase_27 AC 25 ms
24,264 KB
testcase_28 AC 27 ms
23,304 KB
testcase_29 AC 25 ms
23,412 KB
testcase_30 AC 25 ms
23,436 KB
testcase_31 AC 26 ms
23,628 KB
testcase_32 AC 26 ms
23,832 KB
testcase_33 AC 26 ms
23,724 KB
testcase_34 AC 25 ms
23,268 KB
testcase_35 AC 25 ms
23,412 KB
testcase_36 AC 26 ms
23,544 KB
testcase_37 AC 27 ms
23,724 KB
testcase_38 AC 26 ms
24,036 KB
testcase_39 AC 26 ms
23,412 KB
testcase_40 AC 25 ms
23,544 KB
testcase_41 AC 26 ms
23,268 KB
testcase_42 AC 25 ms
24,240 KB
testcase_43 AC 25 ms
23,424 KB
testcase_44 AC 25 ms
23,736 KB
testcase_45 AC 25 ms
23,412 KB
testcase_46 AC 25 ms
23,508 KB
testcase_47 AC 24 ms
24,300 KB
testcase_48 AC 25 ms
23,256 KB
testcase_49 AC 25 ms
23,736 KB
testcase_50 AC 25 ms
23,916 KB
testcase_51 AC 25 ms
23,268 KB
testcase_52 AC 25 ms
23,364 KB
testcase_53 AC 25 ms
23,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<bitset>
#include<iostream>
#include<iomanip>
#include<set>
#include<string>
#include<math.h>
#include<stack>
#include<string>
#include<queue>
#include<vector>
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;

//--------------
///#define DEBUG
//--------------

#ifdef DEBUG
	#define debugprint(x) cout<<x<<" "
	#define debugendl cout<<endl
	#define debug(x) x
#else
	#define debugprint(x)
	#define debugendl
	#define debug(x)
#endif

class zahyo{
	public:
	int x;
	int y;
	zahyo(){
		x=0;
		y=0;
	}
	zahyo(int x_,int y_){
		x=x_;
		y=y_;
	}
	void print(){
		cout<<x<<" "<<y;
	}
	zahyo operator+(zahyo add){
		add.x=this->x+add.x;
		add.y=this->y+add.y;
		return add;
	}
	zahyo operator-(zahyo add){
		add.x=this->x-add.x;
		add.y=this->y-add.y;
		return add;
	}
	zahyo operator*(int t){
		zahyo temp;
		temp.x=this->x*t;
		temp.y=this->y*t;
		return temp;
	}
	zahyo operator%(int t){
		zahyo temp(this->x%t,this->y%t);
		return temp;
	}
	zahyo operator/(int t){
		zahyo temp(this->x/t,this->y/t);
		return temp;
	}
	bool operator==(const zahyo add) const{
		if(add.x==this->x and add.y==this->y){return true;}
		else{return false;}
	}
	bool operator!=(const zahyo add) const{
		if(add.x==this->x or add.y==this->y){return false;}
		else{return true;}
	}
	bool operator<(const zahyo add) const{
		if(this->x<add.x){return true;}
		else if(this->x==add.x and this->y<add.y){return true;}
		else{return false;}
	}
	bool operator>(const zahyo add) const{
		if(this->x>add.x){return true;}
		else if(this->x==add.x and this->y>add.y){return true;}
		else{return false;}
	}
	void input(){
		cin>>x>>y;
	}
};

int main(){
	int ok=0;
	int ng=1001;
	while(ng-ok>1){
		int mida=(ok+ng)/2;
		int midb=(ok+ng)/2+1;
		string ans;
		cout<<"? "<<mida<<endl;
		cin>>ans;
		if(ans=="safe"){
			ok=mida;
			continue;
		}
		cout<<"? "<<midb<<endl;
		cin>>ans;
		if(ans=="safe"){
			ok=midb;
			continue;
		}
		else{
			ng=mida;
		}
	}
	cout<<"! "<<ok<<endl;
	return 0;
}
0