結果
問題 | No.594 壊れた宝物発見機 |
ユーザー |
![]() |
提出日時 | 2017-11-10 23:08:06 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 301 ms / 2,000 ms |
コード長 | 1,582 bytes |
コンパイル時間 | 2,053 ms |
コンパイル使用メモリ | 81,368 KB |
実行使用メモリ | 72,400 KB |
平均クエリ数 | 86.00 |
最終ジャッジ日時 | 2024-07-16 14:30:00 |
合計ジャッジ時間 | 9,356 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
import java.math.BigInteger;import java.util.Arrays;import java.util.LinkedList;import java.util.Scanner;public class Main {public static long MOD = 1000000007;public static void query(int x, int y, int z){System.out.println("?" + " " + x + " " + y + " " + z);}public static void query(int id, int v){switch (id) {case 0: query(v, 0, 0); break;case 1: query(0, v, 0); break;case 2: query(0, 0, v); break;}}public static int search(int id, int upper, int lower, Scanner sc){while(lower + 2 < upper){//System.out.println(lower + " " + upper);final int uul = (upper * 2 + lower) / 3;final int ull = (upper + lower * 2) / 3;query(id, uul);final long uul_value = sc.nextLong();query(id, ull);final long ull_value = sc.nextLong();if(uul_value < ull_value){lower = ull;}else{upper = uul;}}query(id, upper);final long upper_value = sc.nextLong();query(id, lower + 1);final long middle_value = sc.nextLong();query(id, lower);final long lower_value = sc.nextLong();final long min = Math.min(middle_value, Math.min(lower_value, upper_value));if(middle_value == min){return lower + 1;}else if(lower_value == min){return lower;}else{return upper;}}public static void main(String[] args) {Scanner sc = new Scanner(System.in);final int x = search(0, 150, -150, sc);final int y = search(1, 150, -150, sc);final int z = search(2, 150, -150, sc);System.out.println("!" + " " + x + " " + y + " " + z);}}