結果

問題 No.513 宝探し2
ユーザー EtoNagisaEtoNagisa
提出日時 2017-05-05 23:44:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,859 bytes
コンパイル時間 1,141 ms
コンパイル使用メモリ 145,356 KB
実行使用メモリ 24,348 KB
平均クエリ数 27.58
最終ジャッジ日時 2023-09-23 13:50:58
合計ジャッジ時間 3,757 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 24 ms
24,288 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 23 ms
24,000 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 24 ms
23,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int l = -1, r = 100001;
	int d1=0, d2=0;
	const double phi = (1 + sqrt(5)) / 2;
	int flag = -1;
	while (r - l > 1) {
		//cout << "l:" << l << " r:" << r << endl;
		int a1 = (phi*l + r) / (phi + 1), a2 = (l + phi*r) / (phi+1);

		//cout << "a1:" << a1 << " a2:" << a2 << endl;
		if (flag != 0) {
			cout << a1 << " " << 0 << endl;
			cin >> d1;
			//cout << "d2:" << d2 << endl;
		}
		if (flag != 1) {
			cout << a2 << " " << 0 << endl;
			cin >> d2;
			//cout << "d1:" << d1 << endl;
		}
		if (d1 <= d2) {
			r = a2;
			flag = 1;
			d2 = d1;
		}
		else {
			l = a1;
			flag = 0;
			d1 = d2;
		}
	}
	cout << l << " " << 0 << endl;
	cin >> d1;
	cout << r << " " << 0 << endl;
	cin >> d2;
	if(d1<d2)cout << l << " " << d1 << endl;
	else cout << r << " " << d2 << endl;
	return 0;
}
0