結果
問題 | No.2732 Similar Permutations |
ユーザー | mkawa2 |
提出日時 | 2024-11-04 17:01:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 167 ms / 2,000 ms |
コード長 | 1,379 bytes |
コンパイル時間 | 651 ms |
コンパイル使用メモリ | 82,848 KB |
実行使用メモリ | 115,184 KB |
最終ジャッジ日時 | 2024-11-04 17:01:49 |
合計ジャッジ時間 | 25,083 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
53,808 KB |
testcase_01 | AC | 37 ms
53,772 KB |
testcase_02 | AC | 89 ms
86,724 KB |
testcase_03 | AC | 112 ms
97,600 KB |
testcase_04 | AC | 71 ms
82,456 KB |
testcase_05 | AC | 66 ms
80,712 KB |
testcase_06 | AC | 56 ms
70,048 KB |
testcase_07 | AC | 110 ms
92,268 KB |
testcase_08 | AC | 71 ms
83,024 KB |
testcase_09 | AC | 57 ms
76,192 KB |
testcase_10 | AC | 143 ms
115,120 KB |
testcase_11 | AC | 52 ms
73,472 KB |
testcase_12 | AC | 149 ms
111,820 KB |
testcase_13 | AC | 161 ms
111,916 KB |
testcase_14 | AC | 144 ms
111,816 KB |
testcase_15 | AC | 147 ms
111,812 KB |
testcase_16 | AC | 118 ms
104,128 KB |
testcase_17 | AC | 117 ms
104,076 KB |
testcase_18 | AC | 141 ms
111,048 KB |
testcase_19 | AC | 154 ms
111,800 KB |
testcase_20 | AC | 139 ms
112,352 KB |
testcase_21 | AC | 143 ms
111,808 KB |
testcase_22 | AC | 101 ms
98,108 KB |
testcase_23 | AC | 141 ms
112,272 KB |
testcase_24 | AC | 102 ms
99,784 KB |
testcase_25 | AC | 150 ms
112,112 KB |
testcase_26 | AC | 130 ms
110,584 KB |
testcase_27 | AC | 147 ms
112,328 KB |
testcase_28 | AC | 123 ms
107,652 KB |
testcase_29 | AC | 139 ms
112,036 KB |
testcase_30 | AC | 122 ms
104,016 KB |
testcase_31 | AC | 167 ms
111,864 KB |
testcase_32 | AC | 143 ms
111,516 KB |
testcase_33 | AC | 144 ms
112,136 KB |
testcase_34 | AC | 114 ms
101,100 KB |
testcase_35 | AC | 144 ms
112,224 KB |
testcase_36 | AC | 136 ms
111,060 KB |
testcase_37 | AC | 148 ms
112,124 KB |
testcase_38 | AC | 136 ms
110,960 KB |
testcase_39 | AC | 147 ms
111,788 KB |
testcase_40 | AC | 126 ms
110,580 KB |
testcase_41 | AC | 138 ms
112,172 KB |
testcase_42 | AC | 124 ms
106,572 KB |
testcase_43 | AC | 147 ms
111,872 KB |
testcase_44 | AC | 96 ms
97,052 KB |
testcase_45 | AC | 141 ms
112,004 KB |
testcase_46 | AC | 138 ms
111,060 KB |
testcase_47 | AC | 153 ms
115,184 KB |
testcase_48 | AC | 106 ms
100,640 KB |
testcase_49 | AC | 147 ms
115,016 KB |
testcase_50 | AC | 108 ms
100,120 KB |
testcase_51 | AC | 151 ms
114,560 KB |
testcase_52 | AC | 130 ms
110,724 KB |
testcase_53 | AC | 144 ms
112,332 KB |
testcase_54 | AC | 143 ms
111,808 KB |
testcase_55 | AC | 143 ms
111,852 KB |
testcase_56 | AC | 146 ms
112,124 KB |
testcase_57 | AC | 96 ms
96,972 KB |
testcase_58 | AC | 117 ms
103,804 KB |
testcase_59 | AC | 118 ms
103,444 KB |
testcase_60 | AC | 103 ms
97,680 KB |
testcase_61 | AC | 94 ms
95,556 KB |
testcase_62 | AC | 137 ms
110,776 KB |
testcase_63 | AC | 36 ms
52,904 KB |
testcase_64 | AC | 36 ms
53,376 KB |
testcase_65 | AC | 36 ms
53,136 KB |
testcase_66 | AC | 37 ms
52,348 KB |
testcase_67 | AC | 37 ms
53,132 KB |
testcase_68 | AC | 36 ms
52,960 KB |
testcase_69 | AC | 36 ms
52,204 KB |
testcase_70 | AC | 36 ms
53,288 KB |
testcase_71 | AC | 36 ms
53,060 KB |
testcase_72 | AC | 36 ms
52,948 KB |
testcase_73 | AC | 40 ms
53,740 KB |
testcase_74 | AC | 37 ms
54,128 KB |
testcase_75 | AC | 36 ms
54,184 KB |
testcase_76 | AC | 36 ms
53,820 KB |
testcase_77 | AC | 36 ms
52,520 KB |
testcase_78 | AC | 36 ms
54,208 KB |
testcase_79 | AC | 37 ms
52,468 KB |
testcase_80 | AC | 37 ms
52,668 KB |
testcase_81 | AC | 36 ms
53,012 KB |
testcase_82 | AC | 36 ms
53,744 KB |
testcase_83 | AC | 36 ms
53,200 KB |
testcase_84 | AC | 35 ms
52,680 KB |
testcase_85 | AC | 37 ms
52,996 KB |
testcase_86 | AC | 35 ms
53,168 KB |
testcase_87 | AC | 36 ms
53,052 KB |
testcase_88 | AC | 39 ms
53,092 KB |
testcase_89 | AC | 36 ms
52,800 KB |
testcase_90 | AC | 36 ms
52,888 KB |
testcase_91 | AC | 37 ms
53,316 KB |
testcase_92 | AC | 39 ms
54,060 KB |
testcase_93 | AC | 37 ms
52,928 KB |
testcase_94 | AC | 37 ms
53,768 KB |
testcase_95 | AC | 37 ms
53,756 KB |
testcase_96 | AC | 35 ms
53,192 KB |
testcase_97 | AC | 36 ms
52,768 KB |
testcase_98 | AC | 36 ms
53,996 KB |
testcase_99 | AC | 35 ms
53,136 KB |
testcase_100 | AC | 39 ms
54,056 KB |
testcase_101 | AC | 40 ms
52,692 KB |
testcase_102 | AC | 38 ms
53,552 KB |
ソースコード
import sys sys.setrecursionlimit(200005) # sys.set_int_max_str_digits(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] # inf = -1-(-1 << 31) inf = -1-(-1 << 62) md = 10**9+7 # md = 998244353 from itertools import permutations def f(aa, pp): x = 0 for a, p in zip(aa, pp): x ^= a+p return x n = II() aa = LI() if n == 1: print(-1) elif n == 2: x = aa[0]+1 ^ aa[1]+2 y = aa[0]+2 ^ aa[1]+1 if x == y: print(1, 2) print(2, 1) else: print(-1) else: bb = aa[:3] x2p = {} for p in permutations(range(1, 4)): x = f(aa, p) if x in x2p: ans = list(p)+list(range(4, n+1)) print(*ans) ans = list(x2p[x])+list(range(4, n+1)) print(*ans) exit() x2p[x] = p