結果
問題 | No.594 壊れた宝物発見機 |
ユーザー |
|
提出日時 | 2017-11-10 22:48:14 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 303 ms / 2,000 ms |
コード長 | 2,257 bytes |
コンパイル時間 | 3,345 ms |
コンパイル使用メモリ | 81,440 KB |
実行使用メモリ | 72,324 KB |
平均クエリ数 | 100.00 |
最終ジャッジ日時 | 2024-07-16 14:27:55 |
合計ジャッジ時間 | 10,670 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
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)); }}