結果
問題 | No.2732 Similar Permutations |
ユーザー | titia |
提出日時 | 2024-04-21 01:49:46 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,600 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 46,736 KB |
最終ジャッジ日時 | 2024-10-13 00:17:03 |
合計ジャッジ時間 | 38,436 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
10,880 KB |
testcase_01 | AC | 27 ms
10,752 KB |
testcase_02 | AC | 160 ms
21,388 KB |
testcase_03 | AC | 286 ms
30,676 KB |
testcase_04 | AC | 106 ms
17,048 KB |
testcase_05 | AC | 86 ms
15,416 KB |
testcase_06 | AC | 51 ms
12,800 KB |
testcase_07 | AC | 213 ms
25,816 KB |
testcase_08 | AC | 120 ms
18,004 KB |
testcase_09 | AC | 74 ms
14,440 KB |
testcase_10 | AC | 465 ms
45,656 KB |
testcase_11 | AC | 63 ms
13,568 KB |
testcase_12 | AC | 482 ms
46,600 KB |
testcase_13 | AC | 470 ms
45,192 KB |
testcase_14 | AC | 490 ms
45,180 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 501 ms
45,832 KB |
testcase_20 | AC | 506 ms
45,504 KB |
testcase_21 | AC | 483 ms
45,320 KB |
testcase_22 | AC | 305 ms
30,448 KB |
testcase_23 | AC | 522 ms
45,196 KB |
testcase_24 | AC | 307 ms
30,900 KB |
testcase_25 | AC | 471 ms
45,320 KB |
testcase_26 | AC | 407 ms
39,364 KB |
testcase_27 | AC | 488 ms
45,320 KB |
testcase_28 | AC | 379 ms
37,768 KB |
testcase_29 | AC | 472 ms
45,064 KB |
testcase_30 | AC | 353 ms
35,168 KB |
testcase_31 | AC | 517 ms
45,184 KB |
testcase_32 | AC | 461 ms
42,736 KB |
testcase_33 | AC | 549 ms
45,184 KB |
testcase_34 | AC | 324 ms
33,256 KB |
testcase_35 | AC | 508 ms
45,308 KB |
testcase_36 | AC | 491 ms
42,668 KB |
testcase_37 | AC | 496 ms
45,248 KB |
testcase_38 | AC | 445 ms
40,892 KB |
testcase_39 | AC | 515 ms
45,156 KB |
testcase_40 | AC | 405 ms
39,300 KB |
testcase_41 | AC | 485 ms
44,996 KB |
testcase_42 | AC | 361 ms
36,392 KB |
testcase_43 | AC | 486 ms
45,080 KB |
testcase_44 | AC | 270 ms
28,568 KB |
testcase_45 | AC | 500 ms
44,976 KB |
testcase_46 | AC | 454 ms
41,548 KB |
testcase_47 | AC | 486 ms
44,316 KB |
testcase_48 | AC | 296 ms
31,408 KB |
testcase_49 | AC | 492 ms
43,824 KB |
testcase_50 | AC | 293 ms
30,636 KB |
testcase_51 | AC | 468 ms
42,192 KB |
testcase_52 | AC | 393 ms
37,568 KB |
testcase_53 | AC | 482 ms
46,736 KB |
testcase_54 | AC | 465 ms
46,284 KB |
testcase_55 | AC | 471 ms
46,084 KB |
testcase_56 | AC | 512 ms
46,680 KB |
testcase_57 | AC | 269 ms
29,380 KB |
testcase_58 | AC | 343 ms
35,492 KB |
testcase_59 | AC | 319 ms
33,912 KB |
testcase_60 | AC | 272 ms
30,632 KB |
testcase_61 | AC | 251 ms
28,808 KB |
testcase_62 | AC | 395 ms
39,868 KB |
testcase_63 | AC | 28 ms
10,752 KB |
testcase_64 | AC | 29 ms
10,752 KB |
testcase_65 | AC | 29 ms
10,880 KB |
testcase_66 | AC | 30 ms
10,880 KB |
testcase_67 | AC | 30 ms
10,880 KB |
testcase_68 | AC | 28 ms
10,752 KB |
testcase_69 | AC | 28 ms
10,752 KB |
testcase_70 | AC | 27 ms
10,880 KB |
testcase_71 | AC | 28 ms
10,880 KB |
testcase_72 | AC | 28 ms
11,008 KB |
testcase_73 | AC | 28 ms
11,008 KB |
testcase_74 | AC | 28 ms
11,008 KB |
testcase_75 | AC | 28 ms
11,008 KB |
testcase_76 | AC | 27 ms
10,752 KB |
testcase_77 | AC | 28 ms
10,880 KB |
testcase_78 | AC | 28 ms
10,752 KB |
testcase_79 | AC | 27 ms
10,880 KB |
testcase_80 | AC | 28 ms
10,752 KB |
testcase_81 | AC | 28 ms
10,880 KB |
testcase_82 | AC | 28 ms
10,880 KB |
testcase_83 | WA | - |
testcase_84 | AC | 30 ms
11,008 KB |
testcase_85 | AC | 28 ms
10,752 KB |
testcase_86 | AC | 28 ms
10,880 KB |
testcase_87 | WA | - |
testcase_88 | AC | 28 ms
10,880 KB |
testcase_89 | AC | 27 ms
10,880 KB |
testcase_90 | AC | 27 ms
10,880 KB |
testcase_91 | AC | 28 ms
10,880 KB |
testcase_92 | AC | 28 ms
10,880 KB |
testcase_93 | AC | 28 ms
10,880 KB |
testcase_94 | WA | - |
testcase_95 | AC | 28 ms
11,008 KB |
testcase_96 | AC | 28 ms
10,752 KB |
testcase_97 | AC | 28 ms
10,880 KB |
testcase_98 | AC | 28 ms
10,880 KB |
testcase_99 | AC | 29 ms
10,880 KB |
testcase_100 | AC | 29 ms
10,752 KB |
testcase_101 | AC | 29 ms
10,752 KB |
testcase_102 | AC | 28 ms
10,880 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]=2 ANS1[l]=3 ANS2[k]=3 ANS2[l]=2 LL=[2,3] now=1 for i in range(N): if ANS1[i]==0: ANS1[i]=now now+=1 while now in LL: now+=1 now=1 for i in range(N): if ANS2[i]==0: ANS2[i]=now now+=1 while now in LL: 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]+1) 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)