結果

問題 No.2577 Simple Permutation Guess
ユーザー tentententen
提出日時 2023-12-11 11:53:19
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 2,720 bytes
コンパイル時間 3,155 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 77,636 KB
平均クエリ数 251.95
最終ジャッジ日時 2023-12-11 11:53:57
合計ジャッジ時間 34,868 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
68,884 KB
testcase_01 AC 504 ms
77,052 KB
testcase_02 AC 254 ms
75,468 KB
testcase_03 AC 97 ms
70,900 KB
testcase_04 AC 320 ms
77,372 KB
testcase_05 AC 378 ms
77,388 KB
testcase_06 AC 517 ms
77,004 KB
testcase_07 AC 555 ms
76,892 KB
testcase_08 AC 527 ms
77,000 KB
testcase_09 AC 547 ms
77,028 KB
testcase_10 AC 563 ms
76,808 KB
testcase_11 AC 101 ms
70,892 KB
testcase_12 AC 91 ms
70,760 KB
testcase_13 AC 109 ms
69,076 KB
testcase_14 AC 108 ms
70,900 KB
testcase_15 AC 107 ms
70,892 KB
testcase_16 AC 89 ms
70,760 KB
testcase_17 AC 90 ms
70,780 KB
testcase_18 AC 92 ms
70,780 KB
testcase_19 AC 92 ms
70,760 KB
testcase_20 AC 92 ms
70,796 KB
testcase_21 AC 91 ms
70,764 KB
testcase_22 AC 95 ms
70,760 KB
testcase_23 AC 93 ms
70,760 KB
testcase_24 RE -
testcase_25 AC 91 ms
70,740 KB
testcase_26 AC 103 ms
68,808 KB
testcase_27 AC 93 ms
70,764 KB
testcase_28 AC 91 ms
70,780 KB
testcase_29 AC 94 ms
70,768 KB
testcase_30 AC 93 ms
70,768 KB
testcase_31 AC 93 ms
70,768 KB
testcase_32 AC 92 ms
70,772 KB
testcase_33 AC 90 ms
68,808 KB
testcase_34 AC 93 ms
70,764 KB
testcase_35 AC 91 ms
70,768 KB
testcase_36 AC 93 ms
70,768 KB
testcase_37 AC 90 ms
70,644 KB
testcase_38 AC 92 ms
70,756 KB
testcase_39 AC 90 ms
70,776 KB
testcase_40 AC 93 ms
70,760 KB
testcase_41 AC 92 ms
70,752 KB
testcase_42 AC 92 ms
70,752 KB
testcase_43 AC 92 ms
70,772 KB
testcase_44 AC 93 ms
70,780 KB
testcase_45 AC 92 ms
70,740 KB
testcase_46 AC 90 ms
70,764 KB
testcase_47 AC 90 ms
68,816 KB
testcase_48 AC 89 ms
70,760 KB
testcase_49 AC 89 ms
70,772 KB
testcase_50 AC 88 ms
70,764 KB
testcase_51 AC 90 ms
70,768 KB
testcase_52 AC 91 ms
70,772 KB
testcase_53 AC 90 ms
70,772 KB
testcase_54 AC 93 ms
70,780 KB
testcase_55 AC 100 ms
70,780 KB
testcase_56 AC 94 ms
70,760 KB
testcase_57 AC 92 ms
70,780 KB
testcase_58 AC 91 ms
70,768 KB
testcase_59 AC 91 ms
70,760 KB
testcase_60 AC 98 ms
70,772 KB
testcase_61 AC 89 ms
70,768 KB
testcase_62 AC 94 ms
70,780 KB
testcase_63 AC 93 ms
70,772 KB
testcase_64 AC 97 ms
70,768 KB
testcase_65 AC 92 ms
70,768 KB
testcase_66 AC 91 ms
70,764 KB
testcase_67 AC 92 ms
70,772 KB
testcase_68 AC 90 ms
68,824 KB
testcase_69 AC 89 ms
70,788 KB
testcase_70 AC 95 ms
70,764 KB
testcase_71 AC 92 ms
70,796 KB
testcase_72 AC 91 ms
70,760 KB
testcase_73 AC 91 ms
68,872 KB
testcase_74 AC 110 ms
71,028 KB
testcase_75 AC 117 ms
71,004 KB
testcase_76 AC 108 ms
71,024 KB
testcase_77 AC 108 ms
69,068 KB
testcase_78 AC 109 ms
69,080 KB
testcase_79 AC 109 ms
71,036 KB
testcase_80 AC 110 ms
71,028 KB
testcase_81 AC 110 ms
71,044 KB
testcase_82 AC 113 ms
71,012 KB
testcase_83 AC 110 ms
71,024 KB
testcase_84 AC 114 ms
71,020 KB
testcase_85 AC 112 ms
71,016 KB
testcase_86 AC 111 ms
71,032 KB
testcase_87 AC 108 ms
71,044 KB
testcase_88 AC 129 ms
71,024 KB
testcase_89 AC 108 ms
69,128 KB
testcase_90 AC 108 ms
71,032 KB
testcase_91 AC 110 ms
71,016 KB
testcase_92 AC 479 ms
77,128 KB
testcase_93 AC 453 ms
77,180 KB
testcase_94 AC 461 ms
77,284 KB
testcase_95 AC 526 ms
76,852 KB
testcase_96 AC 505 ms
77,364 KB
testcase_97 AC 549 ms
77,636 KB
testcase_98 AC 511 ms
77,104 KB
testcase_99 AC 508 ms
77,056 KB
testcase_100 AC 461 ms
77,120 KB
testcase_101 AC 499 ms
77,148 KB
evil_1_rnd_1.txt AC 851 ms
81,612 KB
evil_1_rnd_2.txt AC 768 ms
78,560 KB
evil_2_big_1.txt AC 937 ms
82,336 KB
evil_2_big_2.txt AC 849 ms
78,344 KB
evil_2_big_3.txt AC 888 ms
78,428 KB
evil_3_sorted_1.txt AC 568 ms
77,888 KB
evil_4_sorted_rev_1.txt AC 548 ms
77,680 KB
evil_4_sorted_rev_2.txt AC 693 ms
79,696 KB
evil_400_sorted.txt AC 933 ms
86,176 KB
evil_400_sorted_rev.txt AC 905 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