結果

問題 No.513 宝探し2
ユーザー kotamanegikotamanegi
提出日時 2017-05-05 22:44:43
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,437 bytes
コンパイル時間 1,198 ms
コンパイル使用メモリ 83,124 KB
実行使用メモリ 24,492 KB
平均クエリ数 112.33
最終ジャッジ日時 2023-09-23 13:23:11
合計ジャッジ時間 3,134 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int judge(int a, int b) {
	cout << a << " " << b << endl;
	int hoge;
	cin >> hoge;
	return hoge;
}
int main() {
	int x = 0;
	int x_top = 100000,x_bot = 0;
	while (x_top - x_bot > 2) {
		int left = (x_bot + x_bot + x_top) / 3;
		int right = (x_top + x_top + x_bot) / 3;
		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