結果

問題 No.594 壊れた宝物発見機
ユーザー uwiuwi
提出日時 2017-11-10 22:29:28
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,257 bytes
コンパイル時間 5,365 ms
コンパイル使用メモリ 80,032 KB
実行使用メモリ 77,512 KB
平均クエリ数 100.00
最終ジャッジ日時 2023-09-23 14:45:32
合計ジャッジ時間 12,473 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

public class D2 {
	static Scanner in;
	static PrintWriter out;
	static String INPUT = "";
	
	static long get(int x, int y, int z)
	{
		out.println("? " + x + " " + y + " " + z);
		out.flush();
		return ni();
	}
	
	static void solve()
	{
		int x = -150, y = -150, z = -150;
		
		{
			int low = -150, high = 151;
			while(high - low > 2){
				int nl = low + (high - low)/3;
				int nh = high + (low - high)/3;
				long vl = get(nl, y, z);
				long vh = get(nh, y, z);
				if(vl < vh){
					high = nh;
				}else{
					low = nl;
				}
			}
			long min = Long.MAX_VALUE;
			for(int i = Math.max(low-2, -150);i <= Math.min(high+2, 150);i++){
				long v = get(i, y, z);
				if(v < min){
					min = v;
					x = i;
				}
			}
		}
		{
			int low = -150, high = 151;
			while(high - low > 2){
				int nl = low + (high - low)/3;
				int nh = high + (low - high)/3;
				long vl = get(x, nl, z);
				long vh = get(x, nh, z);
				if(vl < vh){
					high = nh;
				}else{
					low = nl;
				}
			}
			long min = Long.MAX_VALUE;
			for(int i = Math.max(low-2, -150);i <= Math.min(high+2, 150);i++){
				long v = get(x, i, z);
				if(v < min){
					min = v;
					x = i;
				}
			}
		}
		{
			int low = -150, high = 151;
			while(high - low > 2){
				int nl = low + (high - low)/3;
				int nh = high + (low - high)/3;
				long vl = get(x, y, nl);
				long vh = get(x, y, nh);
				if(vl < vh){
					high = nh;
				}else{
					low = nl;
				}
			}
			long min = Long.MAX_VALUE;
			for(int i = Math.max(low-2, -150);i <= Math.min(high+2, 150);i++){
				long v = get(x, y, i);
				if(v < min){
					min = v;
					x = i;
				}
			}
		}
		out.println("! " + x + " " + y + " " + z);
		out.flush();
	}
	
	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