結果
問題 | No.2732 Similar Permutations |
ユーザー | PNJ |
提出日時 | 2024-04-19 22:56:46 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 175 ms / 2,000 ms |
コード長 | 762 bytes |
コンパイル時間 | 427 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 123,904 KB |
最終ジャッジ日時 | 2024-10-11 16:57:00 |
合計ジャッジ時間 | 23,300 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,096 KB |
testcase_01 | AC | 42 ms
52,096 KB |
testcase_02 | AC | 94 ms
86,656 KB |
testcase_03 | AC | 128 ms
100,224 KB |
testcase_04 | AC | 84 ms
81,024 KB |
testcase_05 | AC | 81 ms
80,128 KB |
testcase_06 | AC | 66 ms
70,784 KB |
testcase_07 | AC | 109 ms
93,824 KB |
testcase_08 | AC | 89 ms
83,072 KB |
testcase_09 | AC | 76 ms
78,848 KB |
testcase_10 | AC | 163 ms
106,112 KB |
testcase_11 | AC | 68 ms
73,472 KB |
testcase_12 | AC | 163 ms
119,936 KB |
testcase_13 | AC | 166 ms
120,064 KB |
testcase_14 | AC | 166 ms
119,680 KB |
testcase_15 | AC | 164 ms
119,680 KB |
testcase_16 | AC | 141 ms
111,104 KB |
testcase_17 | AC | 140 ms
110,592 KB |
testcase_18 | AC | 157 ms
117,888 KB |
testcase_19 | AC | 162 ms
119,808 KB |
testcase_20 | AC | 167 ms
119,936 KB |
testcase_21 | AC | 168 ms
123,648 KB |
testcase_22 | AC | 123 ms
104,576 KB |
testcase_23 | AC | 171 ms
123,776 KB |
testcase_24 | AC | 127 ms
107,392 KB |
testcase_25 | AC | 167 ms
123,648 KB |
testcase_26 | AC | 157 ms
119,040 KB |
testcase_27 | AC | 171 ms
123,904 KB |
testcase_28 | AC | 148 ms
117,248 KB |
testcase_29 | AC | 173 ms
123,648 KB |
testcase_30 | AC | 141 ms
112,384 KB |
testcase_31 | AC | 175 ms
123,776 KB |
testcase_32 | AC | 166 ms
118,784 KB |
testcase_33 | AC | 170 ms
123,520 KB |
testcase_34 | AC | 129 ms
108,800 KB |
testcase_35 | AC | 168 ms
123,648 KB |
testcase_36 | AC | 160 ms
119,296 KB |
testcase_37 | AC | 167 ms
123,648 KB |
testcase_38 | AC | 156 ms
119,168 KB |
testcase_39 | AC | 170 ms
123,904 KB |
testcase_40 | AC | 154 ms
119,168 KB |
testcase_41 | AC | 172 ms
123,776 KB |
testcase_42 | AC | 143 ms
116,736 KB |
testcase_43 | AC | 169 ms
123,648 KB |
testcase_44 | AC | 120 ms
103,296 KB |
testcase_45 | AC | 170 ms
123,520 KB |
testcase_46 | AC | 159 ms
118,912 KB |
testcase_47 | AC | 165 ms
123,520 KB |
testcase_48 | AC | 130 ms
107,648 KB |
testcase_49 | AC | 168 ms
123,648 KB |
testcase_50 | AC | 129 ms
107,392 KB |
testcase_51 | AC | 166 ms
123,392 KB |
testcase_52 | AC | 153 ms
121,344 KB |
testcase_53 | AC | 165 ms
106,240 KB |
testcase_54 | AC | 163 ms
105,984 KB |
testcase_55 | AC | 166 ms
106,368 KB |
testcase_56 | AC | 164 ms
106,112 KB |
testcase_57 | AC | 118 ms
99,840 KB |
testcase_58 | AC | 134 ms
104,448 KB |
testcase_59 | AC | 131 ms
104,832 KB |
testcase_60 | AC | 119 ms
99,968 KB |
testcase_61 | AC | 115 ms
97,920 KB |
testcase_62 | AC | 145 ms
110,208 KB |
testcase_63 | AC | 40 ms
52,096 KB |
testcase_64 | AC | 40 ms
52,480 KB |
testcase_65 | AC | 40 ms
52,224 KB |
testcase_66 | AC | 39 ms
51,712 KB |
testcase_67 | AC | 40 ms
52,224 KB |
testcase_68 | AC | 41 ms
52,096 KB |
testcase_69 | AC | 39 ms
51,968 KB |
testcase_70 | AC | 39 ms
52,480 KB |
testcase_71 | AC | 39 ms
52,096 KB |
testcase_72 | AC | 39 ms
52,096 KB |
testcase_73 | AC | 40 ms
51,968 KB |
testcase_74 | AC | 41 ms
52,224 KB |
testcase_75 | AC | 40 ms
51,840 KB |
testcase_76 | AC | 40 ms
52,224 KB |
testcase_77 | AC | 39 ms
52,096 KB |
testcase_78 | AC | 39 ms
52,480 KB |
testcase_79 | AC | 40 ms
52,096 KB |
testcase_80 | AC | 40 ms
51,712 KB |
testcase_81 | AC | 40 ms
51,712 KB |
testcase_82 | AC | 40 ms
51,840 KB |
testcase_83 | AC | 39 ms
51,712 KB |
testcase_84 | AC | 39 ms
51,712 KB |
testcase_85 | AC | 39 ms
52,352 KB |
testcase_86 | AC | 40 ms
51,712 KB |
testcase_87 | AC | 40 ms
52,224 KB |
testcase_88 | AC | 39 ms
51,968 KB |
testcase_89 | AC | 41 ms
51,840 KB |
testcase_90 | AC | 40 ms
51,840 KB |
testcase_91 | AC | 40 ms
51,968 KB |
testcase_92 | AC | 41 ms
51,712 KB |
testcase_93 | AC | 40 ms
52,096 KB |
testcase_94 | AC | 41 ms
52,096 KB |
testcase_95 | AC | 41 ms
52,096 KB |
testcase_96 | AC | 41 ms
52,352 KB |
testcase_97 | AC | 40 ms
51,840 KB |
testcase_98 | AC | 41 ms
52,096 KB |
testcase_99 | AC | 41 ms
52,096 KB |
testcase_100 | AC | 40 ms
51,712 KB |
testcase_101 | AC | 39 ms
52,096 KB |
testcase_102 | AC | 41 ms
52,352 KB |
ソースコード
import itertools def make_perm(n): P = list(itertools.permutations([i + 1 for i in range(n)])) return P N = int(input()) A = list(map(int,input().split())) if N <= 4: P = make_perm(N) for p in P: x = 0 for i in range(N): x ^= p[i] + A[i] for q in P: if p == q: continue y = 0 for j in range(N): y ^= q[j] + A[j] if x == y: print(*p) print(*q) exit() print(-1) exit() X = [[] for i in range(4)] for i in range(N): X[A[i] % 4].append(i) for i in range(4): if len(X[i]) >= 2: l,r = X[i][0],X[i][1] break P = [-1 for i in range(N)] P[l] = 1 P[r] = 2 n = 3 for i in range(N): if P[i] == -1: P[i] = n n += 1 print(*P) P[l],P[r] = P[r],P[l] print(*P)