結果

問題 No.2732 Similar Permutations
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2024-04-19 22:18:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 1,065 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 111,872 KB
最終ジャッジ日時 2024-04-19 22:18:49
合計ジャッジ時間 22,688 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
53,888 KB
testcase_01 AC 43 ms
53,888 KB
testcase_02 AC 99 ms
87,552 KB
testcase_03 AC 120 ms
98,560 KB
testcase_04 AC 82 ms
82,944 KB
testcase_05 AC 79 ms
80,896 KB
testcase_06 AC 65 ms
70,912 KB
testcase_07 AC 104 ms
92,800 KB
testcase_08 AC 84 ms
83,584 KB
testcase_09 AC 70 ms
77,184 KB
testcase_10 AC 156 ms
111,232 KB
testcase_11 AC 67 ms
73,344 KB
testcase_12 AC 157 ms
110,976 KB
testcase_13 AC 163 ms
111,104 KB
testcase_14 AC 160 ms
111,232 KB
testcase_15 AC 159 ms
111,488 KB
testcase_16 AC 140 ms
105,472 KB
testcase_17 AC 138 ms
105,216 KB
testcase_18 AC 152 ms
108,288 KB
testcase_19 AC 161 ms
111,104 KB
testcase_20 AC 176 ms
111,232 KB
testcase_21 AC 162 ms
111,232 KB
testcase_22 AC 119 ms
98,816 KB
testcase_23 AC 160 ms
111,104 KB
testcase_24 AC 126 ms
101,248 KB
testcase_25 AC 158 ms
111,104 KB
testcase_26 AC 146 ms
111,872 KB
testcase_27 AC 158 ms
111,104 KB
testcase_28 AC 140 ms
108,416 KB
testcase_29 AC 157 ms
111,360 KB
testcase_30 AC 133 ms
105,216 KB
testcase_31 AC 157 ms
110,976 KB
testcase_32 AC 151 ms
108,160 KB
testcase_33 AC 157 ms
111,104 KB
testcase_34 AC 130 ms
102,144 KB
testcase_35 AC 160 ms
111,232 KB
testcase_36 AC 146 ms
108,544 KB
testcase_37 AC 157 ms
111,104 KB
testcase_38 AC 145 ms
108,544 KB
testcase_39 AC 155 ms
110,848 KB
testcase_40 AC 149 ms
111,872 KB
testcase_41 AC 159 ms
110,976 KB
testcase_42 AC 145 ms
107,648 KB
testcase_43 AC 155 ms
110,976 KB
testcase_44 AC 114 ms
98,048 KB
testcase_45 AC 158 ms
111,232 KB
testcase_46 AC 139 ms
108,032 KB
testcase_47 AC 173 ms
111,488 KB
testcase_48 AC 114 ms
100,864 KB
testcase_49 AC 168 ms
111,104 KB
testcase_50 AC 124 ms
100,992 KB
testcase_51 AC 155 ms
111,104 KB
testcase_52 AC 149 ms
111,488 KB
testcase_53 AC 160 ms
111,232 KB
testcase_54 AC 161 ms
111,232 KB
testcase_55 AC 161 ms
111,104 KB
testcase_56 AC 159 ms
111,232 KB
testcase_57 AC 117 ms
98,048 KB
testcase_58 AC 136 ms
105,216 KB
testcase_59 AC 131 ms
104,576 KB
testcase_60 AC 123 ms
98,432 KB
testcase_61 AC 117 ms
96,128 KB
testcase_62 AC 151 ms
111,616 KB
testcase_63 AC 44 ms
53,888 KB
testcase_64 AC 43 ms
54,016 KB
testcase_65 AC 45 ms
54,272 KB
testcase_66 AC 45 ms
53,888 KB
testcase_67 AC 43 ms
53,888 KB
testcase_68 AC 45 ms
54,272 KB
testcase_69 AC 44 ms
54,144 KB
testcase_70 AC 43 ms
53,888 KB
testcase_71 AC 44 ms
53,888 KB
testcase_72 AC 45 ms
54,144 KB
testcase_73 AC 44 ms
54,016 KB
testcase_74 AC 45 ms
53,888 KB
testcase_75 AC 44 ms
54,144 KB
testcase_76 AC 44 ms
54,144 KB
testcase_77 AC 45 ms
53,504 KB
testcase_78 AC 44 ms
54,016 KB
testcase_79 AC 43 ms
53,760 KB
testcase_80 AC 43 ms
53,888 KB
testcase_81 AC 43 ms
53,888 KB
testcase_82 AC 44 ms
53,760 KB
testcase_83 AC 43 ms
53,888 KB
testcase_84 AC 44 ms
53,888 KB
testcase_85 AC 44 ms
53,504 KB
testcase_86 AC 44 ms
54,144 KB
testcase_87 AC 45 ms
54,016 KB
testcase_88 AC 44 ms
53,760 KB
testcase_89 AC 43 ms
53,632 KB
testcase_90 AC 43 ms
54,016 KB
testcase_91 AC 44 ms
54,016 KB
testcase_92 AC 42 ms
54,016 KB
testcase_93 AC 43 ms
53,504 KB
testcase_94 AC 43 ms
53,504 KB
testcase_95 AC 44 ms
53,760 KB
testcase_96 AC 44 ms
54,144 KB
testcase_97 AC 43 ms
53,760 KB
testcase_98 AC 43 ms
53,760 KB
testcase_99 AC 43 ms
53,760 KB
testcase_100 AC 44 ms
53,760 KB
testcase_101 AC 44 ms
54,016 KB
testcase_102 AC 45 ms
54,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

1,2の位置で構成する
2の桁以上で、最初に0になる桁が同じ数があれば終わり

実験

"""

import sys
import random

N = int(input())

if N == 1:
    print (-1)
    sys.exit()

A = list(map(int,input().split()))

tup = None

if N <= 1000:
    for i in range(N):
        for j in range(i+1,N):

            if (A[i]+1)^(A[j]+2) == (A[i]+2)^(A[j]+1):
                tup = (i,j)
                break

else:
    import random
    for lp in range(10**6):
        i,j = random.randint(0,N-1),random.randint(0,N-1)
        if i == j:
            continue
        if (A[i]+1)^(A[j]+2) == (A[i]+2)^(A[j]+1):
            tup = (i,j)
            break



if True:
    if tup == None:
        print (-1)
        sys.exit()
    else:
        P = [None] * N
        Q = [None] * N

        P[tup[0]] = Q[tup[1]] = 1
        P[tup[1]] = Q[tup[0]] = 2

        #print (P,Q)

        cnt = 3
        for i in range(N):
            if P[i] == None:
                P[i] = Q[i] = cnt
                cnt += 1

        print (*P)
        print (*Q)


0