結果

問題 No.1187 皇帝ペンギン
ユーザー leaf_1415
提出日時 2020-08-22 13:46:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 1,041 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 79,624 KB
実行使用メモリ 25,452 KB
平均クエリ数 20.96
最終ジャッジ日時 2024-07-17 06:13:03
合計ジャッジ時間 4,885 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 998244353

using namespace std;
typedef pair<llint, llint> P;

llint n, d;

bool check(llint x)
{
	string res, res2;
	cout << "? " << x << endl;
	cin >> res;
	cout << "? " << x+1 << endl;
	cin >> res2;
	
	if(res == "out" && res2 == "out") return false;
	return true;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
		
	llint ub = 1005, lb = 0, mid;
	while(ub-lb>1){
		mid = (ub+lb)/2;
		if(check(mid)) lb = mid;
		else ub = mid;
	}
	cout << "! " << lb << endl;
	
	return 0;
}
0