結果

問題 No.513 宝探し2
ユーザー kotamanegikotamanegi
提出日時 2017-05-05 22:51:34
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,600 bytes
コンパイル時間 1,870 ms
コンパイル使用メモリ 84,660 KB
実行使用メモリ 24,324 KB
平均クエリ数 30.08
最終ジャッジ日時 2023-09-23 13:26:54
合計ジャッジ時間 6,854 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int judged[1000][1000] = {};
int judge(int a, int b) {
	if (judged[a][b] != 0) return judged[a][b] - 1;
	cout << a << " " << b << endl;
	int hoge;
	cin >> hoge;
	return judged[a][b] = hoge+1;
}
int main() {
	int x = 0;
	int x_top = 100000,x_bot = 0;
	while (x_top - x_bot > 2) {
		int left= (double)(x_top - x_bot) / (GOLD + 1.0) + x_bot;
		int right = (double)(x_top - x_bot) / GOLD + x_bot;
		if (judge(0,left) > judge(0,right)) {
			x_bot = left;
		}
		else {
			x_top = right;
		}
	}
	if (judge(0, x_bot) < judge(0, x_bot + 1)) {
		x = x_bot;
	}
	else {
		if (judge(0, x_bot + 1) < judge(0, x_bot + 2)) {
			x = x_bot + 1;
		}
		else {
			x = x_bot + 2;
		}
	}
	int y_top = 100000, y_bot = 0;
	while (y_top - y_bot > 2) {
		int left = (y_bot + y_bot + y_top) / 3;
		int right = (y_top + y_top + y_bot) / 3;
		if (judge(left,x) > judge(right,x)) {
			y_bot = left;
		}
		else {
			y_top = right;
		}
	}
	for (int i = 0;i < 3;++i) {
		judge(y_bot + i, x);
	}
	return 0;
}
0