結果
問題 | No.2577 Simple Permutation Guess |
ユーザー | tenten |
提出日時 | 2023-12-05 09:13:45 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,720 bytes |
コンパイル時間 | 5,685 ms |
コンパイル使用メモリ | 86,692 KB |
実行使用メモリ | 63,084 KB |
平均クエリ数 | 251.95 |
最終ジャッジ日時 | 2024-09-27 00:05:45 |
合計ジャッジ時間 | 38,808 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 102 ms
54,444 KB |
testcase_01 | AC | 527 ms
62,104 KB |
testcase_02 | AC | 285 ms
60,800 KB |
testcase_03 | AC | 104 ms
54,268 KB |
testcase_04 | AC | 354 ms
62,616 KB |
testcase_05 | AC | 388 ms
62,420 KB |
testcase_06 | AC | 591 ms
62,516 KB |
testcase_07 | AC | 588 ms
62,412 KB |
testcase_08 | AC | 583 ms
62,440 KB |
testcase_09 | AC | 587 ms
61,964 KB |
testcase_10 | AC | 592 ms
62,592 KB |
testcase_11 | AC | 107 ms
54,728 KB |
testcase_12 | AC | 99 ms
54,280 KB |
testcase_13 | AC | 119 ms
55,164 KB |
testcase_14 | AC | 113 ms
54,480 KB |
testcase_15 | AC | 104 ms
54,248 KB |
testcase_16 | AC | 102 ms
54,276 KB |
testcase_17 | AC | 98 ms
54,564 KB |
testcase_18 | AC | 95 ms
54,712 KB |
testcase_19 | AC | 95 ms
54,176 KB |
testcase_20 | AC | 95 ms
54,288 KB |
testcase_21 | AC | 97 ms
54,160 KB |
testcase_22 | AC | 98 ms
54,904 KB |
testcase_23 | AC | 96 ms
54,436 KB |
testcase_24 | RE | - |
testcase_25 | AC | 98 ms
53,736 KB |
testcase_26 | AC | 99 ms
54,552 KB |
testcase_27 | AC | 94 ms
54,412 KB |
testcase_28 | AC | 95 ms
54,396 KB |
testcase_29 | AC | 99 ms
54,004 KB |
testcase_30 | AC | 97 ms
54,440 KB |
testcase_31 | AC | 98 ms
54,100 KB |
testcase_32 | AC | 96 ms
54,520 KB |
testcase_33 | AC | 95 ms
53,976 KB |
testcase_34 | AC | 96 ms
54,532 KB |
testcase_35 | AC | 96 ms
54,692 KB |
testcase_36 | AC | 97 ms
54,400 KB |
testcase_37 | AC | 93 ms
54,592 KB |
testcase_38 | AC | 94 ms
54,228 KB |
testcase_39 | AC | 96 ms
54,456 KB |
testcase_40 | AC | 95 ms
54,168 KB |
testcase_41 | AC | 94 ms
54,240 KB |
testcase_42 | AC | 96 ms
54,484 KB |
testcase_43 | AC | 94 ms
54,404 KB |
testcase_44 | AC | 95 ms
54,344 KB |
testcase_45 | AC | 97 ms
54,416 KB |
testcase_46 | AC | 96 ms
54,068 KB |
testcase_47 | AC | 95 ms
54,672 KB |
testcase_48 | AC | 104 ms
54,296 KB |
testcase_49 | AC | 107 ms
54,660 KB |
testcase_50 | AC | 107 ms
54,440 KB |
testcase_51 | AC | 107 ms
54,376 KB |
testcase_52 | AC | 105 ms
54,064 KB |
testcase_53 | AC | 106 ms
54,580 KB |
testcase_54 | AC | 106 ms
54,212 KB |
testcase_55 | AC | 93 ms
54,128 KB |
testcase_56 | AC | 94 ms
54,228 KB |
testcase_57 | AC | 95 ms
54,228 KB |
testcase_58 | AC | 96 ms
54,000 KB |
testcase_59 | AC | 95 ms
54,508 KB |
testcase_60 | AC | 94 ms
54,720 KB |
testcase_61 | AC | 94 ms
54,492 KB |
testcase_62 | AC | 94 ms
54,196 KB |
testcase_63 | AC | 94 ms
54,700 KB |
testcase_64 | AC | 95 ms
54,656 KB |
testcase_65 | AC | 96 ms
54,252 KB |
testcase_66 | AC | 97 ms
54,436 KB |
testcase_67 | AC | 97 ms
54,208 KB |
testcase_68 | AC | 95 ms
53,724 KB |
testcase_69 | AC | 95 ms
54,548 KB |
testcase_70 | AC | 97 ms
54,112 KB |
testcase_71 | AC | 97 ms
54,648 KB |
testcase_72 | AC | 95 ms
54,572 KB |
testcase_73 | AC | 96 ms
54,492 KB |
testcase_74 | AC | 115 ms
55,152 KB |
testcase_75 | AC | 113 ms
54,592 KB |
testcase_76 | AC | 114 ms
54,600 KB |
testcase_77 | AC | 113 ms
54,836 KB |
testcase_78 | AC | 115 ms
54,908 KB |
testcase_79 | AC | 116 ms
54,684 KB |
testcase_80 | AC | 117 ms
54,872 KB |
testcase_81 | AC | 114 ms
54,560 KB |
testcase_82 | AC | 116 ms
54,364 KB |
testcase_83 | AC | 116 ms
54,928 KB |
testcase_84 | AC | 116 ms
54,016 KB |
testcase_85 | AC | 114 ms
54,404 KB |
testcase_86 | AC | 118 ms
54,944 KB |
testcase_87 | AC | 116 ms
54,588 KB |
testcase_88 | AC | 116 ms
54,860 KB |
testcase_89 | AC | 115 ms
55,104 KB |
testcase_90 | AC | 114 ms
54,272 KB |
testcase_91 | AC | 115 ms
54,340 KB |
testcase_92 | AC | 539 ms
62,116 KB |
testcase_93 | AC | 498 ms
62,492 KB |
testcase_94 | AC | 505 ms
62,380 KB |
testcase_95 | AC | 570 ms
62,084 KB |
testcase_96 | AC | 584 ms
63,084 KB |
testcase_97 | AC | 584 ms
62,056 KB |
testcase_98 | AC | 557 ms
62,272 KB |
testcase_99 | AC | 565 ms
61,816 KB |
testcase_100 | AC | 498 ms
61,772 KB |
testcase_101 | AC | 588 ms
62,584 KB |
evil_1_rnd_1.txt | AC | 852 ms
67,404 KB |
evil_1_rnd_2.txt | AC | 844 ms
68,476 KB |
evil_2_big_1.txt | AC | 949 ms
68,284 KB |
evil_2_big_2.txt | AC | 990 ms
67,776 KB |
evil_2_big_3.txt | AC | 949 ms
64,016 KB |
evil_3_sorted_1.txt | AC | 640 ms
62,928 KB |
evil_4_sorted_rev_1.txt | AC | 619 ms
63,232 KB |
evil_4_sorted_rev_2.txt | AC | 735 ms
64,160 KB |
evil_400_sorted.txt | AC | 944 ms
67,200 KB |
evil_400_sorted_rev.txt | AC | 1,004 ms
71,940 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); ArrayList<Integer> remain = new ArrayList<>(); for (int i = 1; i <= n; i++) { remain.add(i); } int[] ans = new int[n]; for (int i = 0; i < n; i++) { int left = 0; int right = remain.size(); while (right - left > 1) { int m = (left + right) / 2; ans[i] = remain.get(m); int idx = 0; for (int j = i + 1; j < n; j++) { if (idx == m) { idx++; } ans[j] = remain.get(idx); idx++; } System.out.println("? " + String.join(" ", Arrays.stream(ans).mapToObj(String::valueOf).toArray(String[]::new))); System.out.flush(); int ret = sc.nextInt(); if (ret == 0) { right = m; } else if (ret == 1) { left = m; } else { return; } } ans[i] = remain.get(left); remain.remove(left); } System.out.println("! " + String.join(" ", Arrays.stream(ans).mapToObj(String::valueOf).toArray(String[]::new))); } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }