結果

問題 No.594 壊れた宝物発見機
ユーザー tetsutetsu
提出日時 2017-11-11 20:50:28
言語 Java19
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,321 bytes
コンパイル時間 4,064 ms
コンパイル使用メモリ 76,340 KB
実行使用メモリ 71,108 KB
平均クエリ数 1.00
最終ジャッジ日時 2023-09-23 15:04:32
合計ジャッジ時間 9,336 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.*;

public class P594 {
	
	static long query(int n, int z) {
		String s = "?";
		for(int i=0; i<3; i++) {
			if(i==n) {
				s += " " + z;
			} else {
				s += " " + 0;
			}
		}
		System.out.println(s);
		return nl();
	}
	
	private static boolean f(int n, int k) {
		return query(n, k) - query(n, k+1) > 0;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int[] ret = new int[3];
		for(int i=0; i<3; i++) {
			int left = -151;
			int right = 150;
			while(Math.abs(left-right)>1) {
				int k= (left+right)/2;
				if(f(i, k)) {
					left = k;
				} else {
					right = k;
				}
			}
			ret[i] = right;
		}
		System.out.printf("! %d %d %d\n", ret[0], ret[1], ret[2]);
	}
	
	private static java.io.InputStream is = System.in;
	private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
	private static java.util.StringTokenizer tokenizer = null;
	private static java.io.BufferedReader reader;
	
	private static long nl() {
		return Long.parseLong(next());
	}

	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new java.util.StringTokenizer(reader.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
}
0