結果

問題 No.514 宝探し3
ユーザー myantamyanta
提出日時 2017-05-05 22:43:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 25,000 KB
実行使用メモリ 24,168 KB
平均クエリ数 3.50
最終ジャッジ日時 2023-09-23 13:22:38
合計ジャッジ時間 1,535 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
23,904 KB
testcase_01 AC 24 ms
24,168 KB
testcase_02 AC 25 ms
23,760 KB
testcase_03 AC 25 ms
24,144 KB
testcase_04 AC 24 ms
23,760 KB
testcase_05 AC 24 ms
23,916 KB
testcase_06 AC 24 ms
24,132 KB
testcase_07 AC 24 ms
23,748 KB
testcase_08 AC 24 ms
23,760 KB
testcase_09 AC 24 ms
23,760 KB
testcase_10 AC 25 ms
23,532 KB
testcase_11 AC 25 ms
23,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>

#define NUM_MAX 1000000000

int ask(int x, int y)
{
	int d;

	printf("%d %d\n", x, y);
	fflush(stdout);
	scanf("%d", &d);
	return d;
}


int main(void)
{
	int i;
	int x, y;
	int d, d2, d3;

	for(i=0;i<25;i++)
	{
		d=ask(0, 0);
		if(d==0) break;
		d2=ask(NUM_MAX, 0);
		if(d2==0) break;
		d3=ask(0, NUM_MAX);
		if(d3==0) break;
		x=(d+d3-NUM_MAX)/2;
		y=(d+d2-NUM_MAX)/2;
		if(ask(x, y)==0) return 0;
	}

	return 0;
}
0