結果

問題 No.514 宝探し3
ユーザー bal4ubal4u
提出日時 2019-07-16 07:11:41
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 27,880 KB
実行使用メモリ 24,300 KB
平均クエリ数 4.08
最終ジャッジ日時 2023-09-23 17:56:15
合計ジャッジ時間 1,625 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,916 KB
testcase_01 AC 25 ms
23,520 KB
testcase_02 AC 25 ms
23,472 KB
testcase_03 AC 25 ms
23,580 KB
testcase_04 AC 25 ms
24,300 KB
testcase_05 AC 28 ms
23,556 KB
testcase_06 AC 26 ms
23,400 KB
testcase_07 AC 25 ms
23,400 KB
testcase_08 AC 26 ms
23,352 KB
testcase_09 AC 25 ms
23,496 KB
testcase_10 AC 26 ms
23,424 KB
testcase_11 AC 25 ms
24,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// yukicoder: No.514 宝探し3
// 2019.7.16 bal4u

#include <stdio.h>
#include <stdlib.h>

#define MAX 1000000000

int ask(int x, int y) {
	int d;
	printf("%d %d\n", x, y), fflush(stdout);
	scanf("%d", &d);
	if (d == 0) exit(0);
	return d;
}

int main()
{
	int x, y, dl, dr;

	dl = ask(0,0), dr = ask(MAX, 0);
	if (dl == dr) x = MAX/2;
	if (dl > dr) x = ((dl-dr) + MAX) / 2;
	else x = (MAX-(dr-dl)) / 2;
	
	dl = ask(x, 0), dr = ask(x, MAX);
	if (dl == dr) y = MAX/2;
	if (dl > dr) y = ((dl-dr) + MAX) / 2;
	else y = (MAX-(dr-dl)) / 2;
	
	ask(x, y);
	return 0;
}
0