結果
問題 | No.624 Santa Claus and The Last Dungeon |
ユーザー | uwi |
提出日時 | 2017-12-24 23:55:00 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,289 bytes |
コンパイル時間 | 4,323 ms |
コンパイル使用メモリ | 83,944 KB |
実行使用メモリ | 73,704 KB |
平均クエリ数 | 74.06 |
最終ジャッジ日時 | 2024-07-16 15:11:36 |
合計ジャッジ時間 | 23,007 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
ソースコード
package adv2017; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class N624_4 { static Scanner in; static PrintWriter out; static String INPUT = ""; static void solve() { int Q = ni(); Random gen = new Random(); int[] ord = shuffle(100, gen); tens = new int[100]; Arrays.fill(tens, -1); ones = new int[100]; Arrays.fill(ones, -1); { int[] alive = Arrays.copyOf(ord, 100); for(int i = 0;i < 9;i++){ dfs(alive, 0, 100, 0, 10); if(i <= 7){ int[] nalive = new int[90-i*10]; int p = 0; for(int j = 0;j < alive.length;j++){ if(tens[alive[j]] == -1){ nalive[p++] = alive[j]; } } assert nalive.length == p; }else{ for(int j = 0;j < alive.length;j++){ if(tens[alive[j]] == -1){ tens[alive[j]] = 9; } } } } } { int[] alive = Arrays.copyOf(ord, 100); for(int i = 0;i < 9;i++){ dfs1(alive, 0, 100, 0, 10); if(i <= 7){ int[] nalive = new int[90-i*10]; int p = 0; for(int j = 0;j < alive.length;j++){ if(ones[alive[j]] == -1){ nalive[p++] = alive[j]; } } assert nalive.length == p; }else{ for(int j = 0;j < alive.length;j++){ if(ones[alive[j]] == -1){ ones[alive[j]] = 9; } } } } } String[] ans = new String[100]; for(int i = 0;i < 100;i++){ ans[i] = "" + tens[i] + ones[i]; } q(ans, true); } static int[] q(String[] qs, boolean end) { for(int i = 0;i < qs.length;i++){ out.print(qs[i] + " "); } out.println(); out.flush(); if(!end){ return new int[]{ni(), ni(), ni()}; }else{ return null; } } static int[] tens; static int[] ones; static void dfs(int[] alive, int l, int r, int z, int prev) { if(prev == r-l){ for(int i = l;i < r;i++){ tens[alive[i]] = z; } return; } int h = l+r>>1; String[] qs = new String[100]; Arrays.fill(qs, "??"); for(int i = 0;i < h-l;i++){ qs[alive[l+i]] = z + "?"; } int lc = q(qs, false)[1]; if(lc > 0)dfs(alive, l, h, z, lc); if(prev-lc > 0)dfs(alive, h, r, z, prev-lc); } static void dfs1(int[] alive, int l, int r, int z, int prev) { if(prev == r-l){ for(int i = l;i < r;i++){ ones[alive[i]] = z; } return; } int h = l+r>>1; String[] qs = new String[100]; Arrays.fill(qs, "??"); for(int i = 0;i < h-l;i++){ qs[alive[l+i]] = "?" + z; } int lc = q(qs, false)[1]; if(lc > 0)dfs1(alive, l, h, z, lc); if(prev-lc > 0)dfs1(alive, h, r, z, prev-lc); } public static int[] shuffle(int n, Random gen){ int[] a = new int[n]; for(int i = 0;i < n;i++)a[i] = i; for(int i = 0;i < n;i++){ int ind = gen.nextInt(n-i)+i; int d = a[i]; a[i] = a[ind]; a[ind] = d; } return a; } 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)); } }