結果
問題 | No.594 壊れた宝物発見機 |
ユーザー | uwi |
提出日時 | 2017-11-10 22:48:14 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 319 ms / 2,000 ms |
コード長 | 2,257 bytes |
コンパイル時間 | 5,121 ms |
コンパイル使用メモリ | 76,348 KB |
実行使用メモリ | 74,612 KB |
平均クエリ数 | 100.00 |
最終ジャッジ日時 | 2023-09-23 14:48:43 |
合計ジャッジ時間 | 11,754 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 312 ms
72,808 KB |
testcase_01 | AC | 311 ms
74,612 KB |
testcase_02 | AC | 310 ms
72,524 KB |
testcase_03 | AC | 306 ms
73,212 KB |
testcase_04 | AC | 319 ms
72,856 KB |
testcase_05 | AC | 302 ms
72,520 KB |
testcase_06 | AC | 307 ms
72,840 KB |
testcase_07 | AC | 305 ms
73,072 KB |
testcase_08 | AC | 305 ms
72,804 KB |
testcase_09 | AC | 292 ms
73,028 KB |
testcase_10 | AC | 306 ms
73,044 KB |
testcase_11 | AC | 309 ms
71,220 KB |
testcase_12 | AC | 313 ms
72,704 KB |
testcase_13 | AC | 311 ms
73,008 KB |
testcase_14 | AC | 308 ms
73,144 KB |
testcase_15 | AC | 308 ms
73,000 KB |
testcase_16 | AC | 308 ms
72,540 KB |
testcase_17 | AC | 308 ms
72,720 KB |
testcase_18 | AC | 305 ms
72,824 KB |
testcase_19 | AC | 308 ms
72,964 KB |
ソースコード
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; y = 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; z = 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)); } }