結果

問題 No.513 宝探し2
ユーザー uwiuwi
提出日時 2017-05-05 22:23:46
言語 Java19
(openjdk 21)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 1,011 bytes
コンパイル時間 3,621 ms
コンパイル使用メモリ 78,624 KB
実行使用メモリ 73,180 KB
平均クエリ数 2.83
最終ジャッジ日時 2023-09-24 01:01:22
合計ジャッジ時間 6,739 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
72,584 KB
testcase_01 AC 158 ms
72,128 KB
testcase_02 AC 148 ms
72,720 KB
testcase_03 AC 160 ms
72,612 KB
testcase_04 AC 158 ms
72,456 KB
testcase_05 AC 166 ms
72,800 KB
testcase_06 AC 151 ms
71,896 KB
testcase_07 AC 163 ms
72,788 KB
testcase_08 AC 158 ms
73,180 KB
testcase_09 AC 163 ms
72,648 KB
testcase_10 AC 162 ms
72,740 KB
testcase_11 AC 155 ms
72,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package contest170505;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class BB {
	static Scanner in;
	static PrintWriter out;
	static String INPUT = "";
	
	static int d(int x, int y)
	{
		out.println(x + " " + y);
		out.flush();
		return ni();
	}
	
	static void solve()
	{
		int d00 = d(0, 0);
		if(d00 == 0)return;
		int d01 = d(0, 1000000);
		if(d01 == 0)return;
		// a+b=D1
		// a+c=D2
		// b+c=10^6
		int a = (d00+d01+1000000)/2-1000000;
		int b = (d00+d01+1000000)/2-d01;
		d(a, b);
	}
	
	public static void main(String[] args) throws Exception
	{
		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);
		
		solve();
		out.flush();
	}
	
	static int ni() { return Integer.parseInt(in.next()); }
	static long nl() { return Long.parseLong(in.next()); }
	static double nd() { return Double.parseDouble(in.next()); }
	static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}
0