結果

問題 No.2732 Similar Permutations
ユーザー titiatitia
提出日時 2024-04-19 22:43:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,472 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 124,288 KB
最終ジャッジ日時 2024-04-19 22:43:47
合計ジャッジ時間 21,819 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,096 KB
testcase_01 AC 41 ms
52,352 KB
testcase_02 AC 88 ms
87,424 KB
testcase_03 AC 117 ms
100,608 KB
testcase_04 AC 75 ms
81,408 KB
testcase_05 AC 72 ms
80,256 KB
testcase_06 AC 61 ms
71,296 KB
testcase_07 AC 99 ms
93,824 KB
testcase_08 AC 77 ms
83,032 KB
testcase_09 AC 70 ms
78,592 KB
testcase_10 AC 151 ms
104,704 KB
testcase_11 AC 62 ms
74,032 KB
testcase_12 AC 152 ms
120,192 KB
testcase_13 AC 150 ms
120,192 KB
testcase_14 AC 151 ms
120,272 KB
testcase_15 AC 153 ms
120,196 KB
testcase_16 AC 129 ms
109,056 KB
testcase_17 AC 135 ms
111,028 KB
testcase_18 AC 148 ms
118,016 KB
testcase_19 AC 153 ms
120,448 KB
testcase_20 AC 149 ms
120,336 KB
testcase_21 AC 157 ms
123,648 KB
testcase_22 AC 116 ms
104,792 KB
testcase_23 AC 157 ms
123,600 KB
testcase_24 AC 121 ms
107,660 KB
testcase_25 AC 160 ms
123,520 KB
testcase_26 AC 143 ms
119,072 KB
testcase_27 AC 158 ms
123,776 KB
testcase_28 AC 139 ms
117,248 KB
testcase_29 AC 158 ms
123,520 KB
testcase_30 AC 128 ms
112,640 KB
testcase_31 AC 172 ms
123,648 KB
testcase_32 AC 153 ms
119,040 KB
testcase_33 AC 160 ms
123,520 KB
testcase_34 AC 124 ms
109,056 KB
testcase_35 AC 164 ms
123,520 KB
testcase_36 AC 150 ms
118,912 KB
testcase_37 AC 158 ms
123,648 KB
testcase_38 AC 146 ms
119,168 KB
testcase_39 AC 164 ms
123,904 KB
testcase_40 AC 143 ms
119,552 KB
testcase_41 AC 161 ms
123,264 KB
testcase_42 AC 137 ms
116,608 KB
testcase_43 AC 170 ms
123,520 KB
testcase_44 AC 116 ms
103,936 KB
testcase_45 AC 166 ms
123,520 KB
testcase_46 AC 154 ms
118,912 KB
testcase_47 AC 157 ms
123,648 KB
testcase_48 AC 126 ms
108,288 KB
testcase_49 AC 160 ms
124,032 KB
testcase_50 AC 150 ms
107,520 KB
testcase_51 AC 157 ms
124,288 KB
testcase_52 AC 144 ms
121,728 KB
testcase_53 AC 161 ms
105,088 KB
testcase_54 AC 159 ms
104,832 KB
testcase_55 AC 156 ms
104,960 KB
testcase_56 AC 157 ms
104,960 KB
testcase_57 AC 115 ms
99,584 KB
testcase_58 AC 131 ms
105,088 KB
testcase_59 AC 128 ms
104,704 KB
testcase_60 AC 113 ms
98,816 KB
testcase_61 AC 110 ms
97,792 KB
testcase_62 AC 139 ms
101,376 KB
testcase_63 AC 41 ms
53,888 KB
testcase_64 AC 41 ms
54,144 KB
testcase_65 AC 41 ms
53,760 KB
testcase_66 AC 41 ms
54,016 KB
testcase_67 AC 37 ms
52,096 KB
testcase_68 AC 39 ms
51,968 KB
testcase_69 AC 38 ms
52,352 KB
testcase_70 AC 39 ms
51,968 KB
testcase_71 AC 39 ms
52,096 KB
testcase_72 WA -
testcase_73 WA -
testcase_74 AC 40 ms
52,352 KB
testcase_75 WA -
testcase_76 AC 38 ms
51,968 KB
testcase_77 AC 35 ms
52,096 KB
testcase_78 AC 38 ms
51,968 KB
testcase_79 AC 36 ms
52,096 KB
testcase_80 AC 39 ms
52,224 KB
testcase_81 AC 36 ms
52,096 KB
testcase_82 AC 36 ms
52,352 KB
testcase_83 AC 39 ms
52,224 KB
testcase_84 AC 36 ms
51,968 KB
testcase_85 AC 36 ms
52,224 KB
testcase_86 AC 37 ms
52,224 KB
testcase_87 AC 36 ms
52,096 KB
testcase_88 AC 37 ms
52,096 KB
testcase_89 AC 37 ms
52,224 KB
testcase_90 AC 37 ms
52,096 KB
testcase_91 AC 37 ms
52,480 KB
testcase_92 AC 37 ms
51,968 KB
testcase_93 AC 36 ms
51,840 KB
testcase_94 AC 36 ms
52,352 KB
testcase_95 AC 37 ms
52,096 KB
testcase_96 AC 37 ms
52,096 KB
testcase_97 AC 38 ms
51,840 KB
testcase_98 AC 38 ms
51,968 KB
testcase_99 AC 37 ms
52,096 KB
testcase_100 AC 37 ms
51,840 KB
testcase_101 AC 37 ms
52,224 KB
testcase_102 AC 37 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
    
    
0