結果
問題 | No.513 宝探し2 |
ユーザー |
![]() |
提出日時 | 2019-08-05 21:04:20 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,033 bytes |
コンパイル時間 | 2,573 ms |
コンパイル使用メモリ | 79,560 KB |
実行使用メモリ | 72,392 KB |
平均クエリ数 | 51.08 |
最終ジャッジ日時 | 2024-07-16 17:52:18 |
合計ジャッジ時間 | 6,363 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 4 RE * 4 |
ソースコード
import java.util.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int l = 0;int r = 100001;int ans1 = 0;while(l < r) {System.out.println(l + " " + 0);System.out.flush();int ret1 = sc.nextInt();int med = (l + r) / 2;System.out.println(med + " " + 0);System.out.flush();int ret2 = sc.nextInt();if(ret2 == (ret1 + l - med)) {ans1 = med;l = med + 1;} else {r = med;}}l = 0;r = 100001;int ans2 = 0;while(l < r) {System.out.println(ans1 + " " + l);System.out.flush();int ret1 = sc.nextInt();int med = (l + r) / 2;System.out.println(ans1 + " " + med);System.out.flush();int ret2 = sc.nextInt();if(ret2 == (ret1 + l - med)) {ans2 = med;l = med + 1;} else {r = med;}}System.out.println(ans1 + " " + ans2);System.out.flush();}}