結果

問題 No.2732 Similar Permutations
ユーザー Yukino DX.Yukino DX.
提出日時 2024-04-27 15:00:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 858 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 116,460 KB
最終ジャッジ日時 2024-04-27 15:00:58
合計ジャッジ時間 21,396 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,352 KB
testcase_01 AC 35 ms
52,352 KB
testcase_02 AC 81 ms
86,912 KB
testcase_03 AC 105 ms
98,048 KB
testcase_04 AC 86 ms
82,560 KB
testcase_05 AC 70 ms
81,024 KB
testcase_06 AC 57 ms
69,632 KB
testcase_07 AC 106 ms
92,408 KB
testcase_08 AC 78 ms
82,944 KB
testcase_09 AC 64 ms
75,776 KB
testcase_10 AC 150 ms
110,464 KB
testcase_11 AC 59 ms
72,192 KB
testcase_12 AC 168 ms
110,592 KB
testcase_13 AC 148 ms
110,464 KB
testcase_14 AC 150 ms
110,592 KB
testcase_15 AC 144 ms
110,464 KB
testcase_16 AC 124 ms
104,704 KB
testcase_17 AC 121 ms
104,448 KB
testcase_18 AC 141 ms
112,768 KB
testcase_19 AC 154 ms
110,336 KB
testcase_20 AC 151 ms
110,464 KB
testcase_21 AC 152 ms
110,848 KB
testcase_22 AC 109 ms
98,304 KB
testcase_23 AC 147 ms
110,592 KB
testcase_24 AC 111 ms
100,352 KB
testcase_25 AC 148 ms
110,592 KB
testcase_26 AC 138 ms
111,872 KB
testcase_27 AC 152 ms
110,464 KB
testcase_28 AC 126 ms
108,288 KB
testcase_29 AC 145 ms
110,592 KB
testcase_30 AC 143 ms
104,704 KB
testcase_31 AC 143 ms
110,336 KB
testcase_32 AC 141 ms
113,024 KB
testcase_33 AC 145 ms
110,592 KB
testcase_34 AC 137 ms
101,760 KB
testcase_35 AC 146 ms
110,464 KB
testcase_36 AC 142 ms
113,024 KB
testcase_37 AC 145 ms
110,336 KB
testcase_38 AC 135 ms
112,000 KB
testcase_39 AC 144 ms
110,336 KB
testcase_40 AC 138 ms
112,256 KB
testcase_41 AC 147 ms
110,336 KB
testcase_42 AC 124 ms
107,520 KB
testcase_43 AC 170 ms
110,776 KB
testcase_44 AC 105 ms
97,664 KB
testcase_45 AC 151 ms
110,440 KB
testcase_46 AC 142 ms
112,384 KB
testcase_47 AC 144 ms
110,336 KB
testcase_48 AC 114 ms
100,808 KB
testcase_49 AC 145 ms
116,460 KB
testcase_50 AC 115 ms
100,420 KB
testcase_51 AC 146 ms
116,156 KB
testcase_52 AC 142 ms
111,456 KB
testcase_53 AC 143 ms
110,732 KB
testcase_54 AC 157 ms
110,336 KB
testcase_55 AC 145 ms
110,336 KB
testcase_56 AC 144 ms
110,208 KB
testcase_57 AC 107 ms
97,920 KB
testcase_58 AC 120 ms
104,704 KB
testcase_59 AC 116 ms
103,808 KB
testcase_60 AC 106 ms
98,176 KB
testcase_61 AC 102 ms
95,488 KB
testcase_62 AC 140 ms
111,616 KB
testcase_63 AC 37 ms
51,968 KB
testcase_64 AC 36 ms
51,840 KB
testcase_65 AC 36 ms
52,352 KB
testcase_66 AC 36 ms
52,352 KB
testcase_67 AC 37 ms
51,968 KB
testcase_68 AC 36 ms
52,480 KB
testcase_69 AC 35 ms
51,968 KB
testcase_70 AC 35 ms
52,224 KB
testcase_71 AC 36 ms
52,736 KB
testcase_72 AC 36 ms
51,968 KB
testcase_73 AC 35 ms
52,352 KB
testcase_74 AC 35 ms
52,736 KB
testcase_75 AC 36 ms
52,224 KB
testcase_76 AC 36 ms
51,968 KB
testcase_77 AC 36 ms
52,224 KB
testcase_78 AC 38 ms
51,968 KB
testcase_79 AC 37 ms
52,736 KB
testcase_80 AC 37 ms
52,608 KB
testcase_81 AC 36 ms
52,736 KB
testcase_82 AC 35 ms
52,480 KB
testcase_83 AC 34 ms
52,480 KB
testcase_84 AC 34 ms
52,480 KB
testcase_85 AC 34 ms
52,096 KB
testcase_86 AC 34 ms
52,224 KB
testcase_87 AC 35 ms
52,096 KB
testcase_88 AC 35 ms
52,352 KB
testcase_89 AC 36 ms
52,224 KB
testcase_90 AC 36 ms
52,096 KB
testcase_91 AC 36 ms
52,352 KB
testcase_92 AC 37 ms
52,736 KB
testcase_93 AC 37 ms
52,352 KB
testcase_94 AC 38 ms
52,608 KB
testcase_95 AC 36 ms
52,352 KB
testcase_96 AC 35 ms
52,608 KB
testcase_97 AC 37 ms
52,352 KB
testcase_98 AC 37 ms
52,608 KB
testcase_99 AC 36 ms
52,736 KB
testcase_100 AC 36 ms
52,096 KB
testcase_101 AC 41 ms
52,352 KB
testcase_102 AC 36 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations


def solve_less10():
    hm = dict()
    for p in permutations(range(1, n + 1), n):
        xor = 0
        for i in range(n):
            xor ^= p[i] + a[i]

        if xor in hm:
            print(*hm[xor])
            print(*p)
            exit()

        hm[xor] = p

    print(-1)


def solve_more10():
    xor_base = 0
    for i in range(11, n + 1):
        xor_base ^= i + a[i - 1]

    hm = dict()
    for p in permutations(range(1, 11), 10):
        xor = 0
        for i in range(10):
            xor ^= p[i] + a[i]

        if xor in hm:
            print(*(hm[xor] + tuple(range(11, n + 1))))
            print(*(p + tuple(range(11, n + 1))))
            exit()

        hm[xor] = p

    print(-1)


n = int(input())
a = list(map(int, input().split()))

if n <= 10:
    solve_less10()
else:
    solve_more10()
0