結果

問題 No.513 宝探し2
ユーザー GrenacheGrenache
提出日時 2017-05-05 22:56:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 1,055 bytes
コンパイル時間 4,501 ms
コンパイル使用メモリ 74,416 KB
実行使用メモリ 72,488 KB
平均クエリ数 2.75
最終ジャッジ日時 2023-09-24 01:05:50
合計ジャッジ時間 6,373 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
72,044 KB
testcase_01 AC 134 ms
71,460 KB
testcase_02 AC 131 ms
72,212 KB
testcase_03 AC 133 ms
72,032 KB
testcase_04 AC 130 ms
72,052 KB
testcase_05 AC 130 ms
71,740 KB
testcase_06 AC 128 ms
72,224 KB
testcase_07 AC 128 ms
71,332 KB
testcase_08 AC 130 ms
72,032 KB
testcase_09 AC 125 ms
72,488 KB
testcase_10 AC 128 ms
71,576 KB
testcase_11 AC 129 ms
72,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder513 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		query(0, 0);
		int a0 = sc.nextInt();
		if (a0 == 0) {
			return;
		}
		query(100_000, 0);
		int a1 = sc.nextInt();
		if (a1 == 0) {
			return;
		}

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

		int tmpx = (a0 - a1 + 100_000) / 2;
		int tmpy = (a0 + a1 - 100_000) / 2;

		for (int i = 0, size = dx.length; i < size; i++) {
			query(tmpx + dx[i], tmpy + dy[i]);
			int tmp = sc.nextInt();
			if (tmp == 0) {
				return;
			}
		}
	}

	private static void query(int x, int y) {
		pr.printf("%d %d\n", x, y);
		pr.flush();
		return;
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0