結果
問題 | No.2732 Similar Permutations |
ユーザー | titia |
提出日時 | 2024-04-19 22:43:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,472 bytes |
コンパイル時間 | 240 ms |
コンパイル使用メモリ | 82,344 KB |
実行使用メモリ | 124,148 KB |
最終ジャッジ日時 | 2024-10-11 16:30:44 |
合計ジャッジ時間 | 22,411 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
52,352 KB |
testcase_01 | AC | 37 ms
52,736 KB |
testcase_02 | AC | 92 ms
87,056 KB |
testcase_03 | AC | 121 ms
100,460 KB |
testcase_04 | AC | 73 ms
81,280 KB |
testcase_05 | AC | 72 ms
80,768 KB |
testcase_06 | AC | 65 ms
71,296 KB |
testcase_07 | AC | 108 ms
93,824 KB |
testcase_08 | AC | 82 ms
83,128 KB |
testcase_09 | AC | 70 ms
78,832 KB |
testcase_10 | AC | 156 ms
105,216 KB |
testcase_11 | AC | 58 ms
74,112 KB |
testcase_12 | AC | 157 ms
120,320 KB |
testcase_13 | AC | 156 ms
120,320 KB |
testcase_14 | AC | 158 ms
120,192 KB |
testcase_15 | AC | 159 ms
120,612 KB |
testcase_16 | AC | 131 ms
109,312 KB |
testcase_17 | AC | 141 ms
111,232 KB |
testcase_18 | AC | 159 ms
118,512 KB |
testcase_19 | AC | 166 ms
120,704 KB |
testcase_20 | AC | 166 ms
120,216 KB |
testcase_21 | AC | 163 ms
123,648 KB |
testcase_22 | AC | 114 ms
104,668 KB |
testcase_23 | AC | 163 ms
123,648 KB |
testcase_24 | AC | 118 ms
107,776 KB |
testcase_25 | AC | 160 ms
123,648 KB |
testcase_26 | AC | 141 ms
119,040 KB |
testcase_27 | AC | 161 ms
123,776 KB |
testcase_28 | AC | 138 ms
117,352 KB |
testcase_29 | AC | 159 ms
123,668 KB |
testcase_30 | AC | 128 ms
112,768 KB |
testcase_31 | AC | 171 ms
123,816 KB |
testcase_32 | AC | 156 ms
119,168 KB |
testcase_33 | AC | 158 ms
123,648 KB |
testcase_34 | AC | 120 ms
109,056 KB |
testcase_35 | AC | 161 ms
123,904 KB |
testcase_36 | AC | 150 ms
119,168 KB |
testcase_37 | AC | 160 ms
123,648 KB |
testcase_38 | AC | 145 ms
119,168 KB |
testcase_39 | AC | 158 ms
123,776 KB |
testcase_40 | AC | 141 ms
119,296 KB |
testcase_41 | AC | 162 ms
123,688 KB |
testcase_42 | AC | 133 ms
116,768 KB |
testcase_43 | AC | 160 ms
123,840 KB |
testcase_44 | AC | 111 ms
103,680 KB |
testcase_45 | AC | 159 ms
123,904 KB |
testcase_46 | AC | 146 ms
119,524 KB |
testcase_47 | AC | 157 ms
123,776 KB |
testcase_48 | AC | 118 ms
108,264 KB |
testcase_49 | AC | 158 ms
123,816 KB |
testcase_50 | AC | 116 ms
108,032 KB |
testcase_51 | AC | 158 ms
124,148 KB |
testcase_52 | AC | 141 ms
122,112 KB |
testcase_53 | AC | 151 ms
105,164 KB |
testcase_54 | AC | 157 ms
104,960 KB |
testcase_55 | AC | 154 ms
105,284 KB |
testcase_56 | AC | 153 ms
105,216 KB |
testcase_57 | AC | 108 ms
99,968 KB |
testcase_58 | AC | 128 ms
104,576 KB |
testcase_59 | AC | 120 ms
104,704 KB |
testcase_60 | AC | 107 ms
98,688 KB |
testcase_61 | AC | 104 ms
97,904 KB |
testcase_62 | AC | 139 ms
101,504 KB |
testcase_63 | AC | 41 ms
54,016 KB |
testcase_64 | AC | 42 ms
53,888 KB |
testcase_65 | AC | 41 ms
53,760 KB |
testcase_66 | AC | 41 ms
54,144 KB |
testcase_67 | AC | 36 ms
52,096 KB |
testcase_68 | AC | 37 ms
52,352 KB |
testcase_69 | AC | 37 ms
52,224 KB |
testcase_70 | AC | 37 ms
52,352 KB |
testcase_71 | AC | 38 ms
52,352 KB |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | AC | 39 ms
52,608 KB |
testcase_75 | WA | - |
testcase_76 | AC | 37 ms
51,968 KB |
testcase_77 | AC | 40 ms
52,352 KB |
testcase_78 | AC | 37 ms
52,352 KB |
testcase_79 | AC | 38 ms
52,352 KB |
testcase_80 | AC | 37 ms
52,352 KB |
testcase_81 | AC | 37 ms
52,480 KB |
testcase_82 | AC | 38 ms
52,136 KB |
testcase_83 | AC | 39 ms
52,352 KB |
testcase_84 | AC | 39 ms
52,480 KB |
testcase_85 | AC | 36 ms
52,352 KB |
testcase_86 | AC | 38 ms
52,480 KB |
testcase_87 | AC | 37 ms
52,224 KB |
testcase_88 | AC | 37 ms
52,224 KB |
testcase_89 | AC | 37 ms
52,352 KB |
testcase_90 | AC | 37 ms
52,608 KB |
testcase_91 | AC | 37 ms
52,224 KB |
testcase_92 | AC | 36 ms
52,480 KB |
testcase_93 | AC | 36 ms
52,224 KB |
testcase_94 | AC | 36 ms
52,352 KB |
testcase_95 | AC | 36 ms
52,352 KB |
testcase_96 | AC | 37 ms
52,468 KB |
testcase_97 | AC | 36 ms
51,968 KB |
testcase_98 | AC | 37 ms
52,352 KB |
testcase_99 | AC | 37 ms
52,224 KB |
testcase_100 | AC | 38 ms
52,352 KB |
testcase_101 | AC | 37 ms
52,352 KB |
testcase_102 | AC | 37 ms
52,736 KB |
ソースコード
import sys input = sys.stdin.readline N=int(input()) A=list(map(int,input().split())) if N==2: x=(A[0]+1)^(A[1]+2) y=(A[0]+2)^(A[1]+1) if x==y: print(1,2) print(2,1) else: 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: k=X[i][0] l=X[i][1] ANS1=[0]*N ANS2=[0]*N ANS1[k]=1 ANS1[l]=2 ANS2[k]=2 ANS2[l]=1 now=3 for i in range(N): if ANS1[i]==0: ANS1[i]=now now+=1 now=3 for i in range(N): if ANS2[i]==0: ANS2[i]=now now+=1 print(*ANS1) print(*ANS2) exit() from itertools import permutations from collections import Counter if N<=5: L=list(permutations(range(N))) ANS=[0]*len(L) for i in range(len(L)): xor=0 for j in range(N): xor^=A[j]+L[i][j] ANS[i]=xor C=Counter(ANS) ans=-1 for c in C: if C[c]>=2: ans=c break if ans==-1: print(ans) exit() IND=[] for i in range(len(L)): if ANS[i]==ans: IND.append(i) AA=[0]*N for i in range(N): AA[i]=L[IND[0]][i]+1 print(*AA) AA=[0]*N for i in range(N): AA[i]=L[IND[1]][i]+1 print(*AA)