結果

問題 No.2577 Simple Permutation Guess
ユーザー tentententen
提出日時 2023-12-05 09:13:45
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 2,720 bytes
コンパイル時間 8,199 ms
コンパイル使用メモリ 91,648 KB
実行使用メモリ 77,660 KB
平均クエリ数 251.95
最終ジャッジ日時 2023-12-05 09:14:28
合計ジャッジ時間 42,107 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
70,768 KB
testcase_01 AC 505 ms
76,940 KB
testcase_02 AC 273 ms
75,712 KB
testcase_03 AC 123 ms
70,784 KB
testcase_04 AC 350 ms
75,052 KB
testcase_05 AC 391 ms
76,656 KB
testcase_06 AC 566 ms
76,860 KB
testcase_07 AC 570 ms
77,120 KB
testcase_08 AC 629 ms
76,936 KB
testcase_09 AC 564 ms
77,040 KB
testcase_10 AC 599 ms
76,948 KB
testcase_11 AC 108 ms
70,880 KB
testcase_12 AC 101 ms
70,784 KB
testcase_13 AC 118 ms
71,032 KB
testcase_14 AC 113 ms
70,888 KB
testcase_15 AC 105 ms
70,784 KB
testcase_16 AC 107 ms
70,760 KB
testcase_17 AC 99 ms
70,748 KB
testcase_18 AC 97 ms
70,788 KB
testcase_19 AC 99 ms
70,772 KB
testcase_20 AC 97 ms
70,752 KB
testcase_21 AC 96 ms
70,772 KB
testcase_22 AC 99 ms
70,784 KB
testcase_23 AC 98 ms
70,756 KB
testcase_24 RE -
testcase_25 AC 125 ms
70,736 KB
testcase_26 AC 101 ms
70,764 KB
testcase_27 AC 99 ms
68,800 KB
testcase_28 AC 100 ms
70,760 KB
testcase_29 AC 100 ms
68,780 KB
testcase_30 AC 101 ms
70,792 KB
testcase_31 AC 99 ms
68,816 KB
testcase_32 AC 101 ms
70,756 KB
testcase_33 AC 115 ms
70,756 KB
testcase_34 AC 100 ms
70,752 KB
testcase_35 AC 98 ms
68,780 KB
testcase_36 AC 97 ms
70,760 KB
testcase_37 AC 93 ms
70,712 KB
testcase_38 AC 96 ms
70,756 KB
testcase_39 AC 98 ms
70,748 KB
testcase_40 AC 99 ms
70,748 KB
testcase_41 AC 97 ms
70,752 KB
testcase_42 AC 111 ms
70,732 KB
testcase_43 AC 108 ms
70,764 KB
testcase_44 AC 97 ms
70,740 KB
testcase_45 AC 98 ms
70,788 KB
testcase_46 AC 98 ms
70,760 KB
testcase_47 AC 98 ms
68,780 KB
testcase_48 AC 98 ms
68,792 KB
testcase_49 AC 97 ms
68,860 KB
testcase_50 AC 98 ms
70,772 KB
testcase_51 AC 104 ms
70,780 KB
testcase_52 AC 97 ms
70,752 KB
testcase_53 AC 99 ms
70,772 KB
testcase_54 AC 97 ms
70,772 KB
testcase_55 AC 95 ms
70,768 KB
testcase_56 AC 98 ms
70,768 KB
testcase_57 AC 110 ms
68,784 KB
testcase_58 AC 109 ms
70,788 KB
testcase_59 AC 112 ms
68,896 KB
testcase_60 AC 97 ms
68,804 KB
testcase_61 AC 97 ms
70,760 KB
testcase_62 AC 97 ms
70,740 KB
testcase_63 AC 95 ms
68,800 KB
testcase_64 AC 97 ms
68,864 KB
testcase_65 AC 96 ms
70,764 KB
testcase_66 AC 98 ms
70,764 KB
testcase_67 AC 98 ms
70,760 KB
testcase_68 AC 113 ms
68,828 KB
testcase_69 AC 97 ms
70,804 KB
testcase_70 AC 112 ms
68,812 KB
testcase_71 AC 112 ms
70,808 KB
testcase_72 AC 97 ms
70,760 KB
testcase_73 AC 98 ms
70,868 KB
testcase_74 AC 116 ms
71,028 KB
testcase_75 AC 116 ms
71,016 KB
testcase_76 AC 132 ms
69,148 KB
testcase_77 AC 115 ms
71,016 KB
testcase_78 AC 117 ms
71,008 KB
testcase_79 AC 117 ms
71,072 KB
testcase_80 AC 118 ms
71,008 KB
testcase_81 AC 116 ms
70,992 KB
testcase_82 AC 116 ms
70,996 KB
testcase_83 AC 116 ms
70,992 KB
testcase_84 AC 143 ms
71,000 KB
testcase_85 AC 118 ms
71,004 KB
testcase_86 AC 119 ms
71,016 KB
testcase_87 AC 119 ms
70,996 KB
testcase_88 AC 118 ms
71,024 KB
testcase_89 AC 119 ms
71,060 KB
testcase_90 AC 117 ms
71,016 KB
testcase_91 AC 130 ms
69,084 KB
testcase_92 AC 514 ms
76,896 KB
testcase_93 AC 491 ms
77,332 KB
testcase_94 AC 497 ms
76,964 KB
testcase_95 AC 560 ms
76,972 KB
testcase_96 AC 582 ms
76,904 KB
testcase_97 AC 582 ms
77,660 KB
testcase_98 AC 565 ms
77,168 KB
testcase_99 AC 550 ms
76,928 KB
testcase_100 AC 519 ms
77,080 KB
testcase_101 AC 538 ms
77,500 KB
evil_1_rnd_1.txt AC 890 ms
83,600 KB
evil_1_rnd_2.txt AC 843 ms
82,084 KB
evil_2_big_1.txt AC 946 ms
84,976 KB
evil_2_big_2.txt AC 950 ms
86,004 KB
evil_2_big_3.txt AC 980 ms
86,184 KB
evil_3_sorted_1.txt AC 636 ms
77,500 KB
evil_4_sorted_rev_1.txt AC 592 ms
77,456 KB
evil_4_sorted_rev_2.txt AC 772 ms
81,856 KB
evil_400_sorted.txt AC 959 ms
84,308 KB
evil_400_sorted_rev.txt AC 1,029 ms
86,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
    }
    
}
0