結果

問題 No.2732 Similar Permutations
ユーザー mkawa2mkawa2
提出日時 2024-04-19 22:47:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,515 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 114,816 KB
最終ジャッジ日時 2024-10-11 16:38:40
合計ジャッジ時間 24,635 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,968 KB
testcase_01 AC 42 ms
52,224 KB
testcase_02 AC 111 ms
86,912 KB
testcase_03 AC 129 ms
97,536 KB
testcase_04 AC 82 ms
81,920 KB
testcase_05 AC 89 ms
79,872 KB
testcase_06 AC 65 ms
69,888 KB
testcase_07 AC 105 ms
91,776 KB
testcase_08 AC 89 ms
82,816 KB
testcase_09 AC 72 ms
76,032 KB
testcase_10 AC 161 ms
111,488 KB
testcase_11 AC 69 ms
73,088 KB
testcase_12 AC 166 ms
111,488 KB
testcase_13 AC 167 ms
111,104 KB
testcase_14 AC 168 ms
111,232 KB
testcase_15 AC 167 ms
111,360 KB
testcase_16 AC 141 ms
104,192 KB
testcase_17 AC 138 ms
103,680 KB
testcase_18 AC 160 ms
108,032 KB
testcase_19 AC 167 ms
111,232 KB
testcase_20 AC 166 ms
111,232 KB
testcase_21 AC 165 ms
111,872 KB
testcase_22 AC 119 ms
97,280 KB
testcase_23 AC 170 ms
111,616 KB
testcase_24 AC 125 ms
99,456 KB
testcase_25 AC 160 ms
111,232 KB
testcase_26 AC 152 ms
110,592 KB
testcase_27 AC 163 ms
111,616 KB
testcase_28 AC 139 ms
107,392 KB
testcase_29 AC 163 ms
111,616 KB
testcase_30 AC 136 ms
103,936 KB
testcase_31 AC 169 ms
111,488 KB
testcase_32 AC 157 ms
108,160 KB
testcase_33 AC 163 ms
111,232 KB
testcase_34 AC 128 ms
100,864 KB
testcase_35 AC 185 ms
111,104 KB
testcase_36 AC 178 ms
108,288 KB
testcase_37 AC 162 ms
111,360 KB
testcase_38 AC 150 ms
110,592 KB
testcase_39 AC 163 ms
111,872 KB
testcase_40 AC 148 ms
110,208 KB
testcase_41 AC 163 ms
111,744 KB
testcase_42 AC 140 ms
106,752 KB
testcase_43 AC 161 ms
111,232 KB
testcase_44 AC 115 ms
96,768 KB
testcase_45 AC 160 ms
111,232 KB
testcase_46 AC 151 ms
110,848 KB
testcase_47 AC 165 ms
111,616 KB
testcase_48 AC 123 ms
99,840 KB
testcase_49 AC 158 ms
111,744 KB
testcase_50 AC 121 ms
99,712 KB
testcase_51 AC 157 ms
114,816 KB
testcase_52 AC 145 ms
110,592 KB
testcase_53 AC 161 ms
111,360 KB
testcase_54 AC 164 ms
111,616 KB
testcase_55 AC 161 ms
111,360 KB
testcase_56 AC 160 ms
111,104 KB
testcase_57 AC 114 ms
96,512 KB
testcase_58 AC 132 ms
103,808 KB
testcase_59 AC 128 ms
102,912 KB
testcase_60 AC 119 ms
97,408 KB
testcase_61 AC 115 ms
95,104 KB
testcase_62 AC 148 ms
110,208 KB
testcase_63 AC 41 ms
52,608 KB
testcase_64 AC 42 ms
52,096 KB
testcase_65 AC 41 ms
52,096 KB
testcase_66 AC 42 ms
52,096 KB
testcase_67 WA -
testcase_68 AC 42 ms
52,096 KB
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 AC 42 ms
51,968 KB
testcase_76 AC 42 ms
51,968 KB
testcase_77 AC 42 ms
51,968 KB
testcase_78 WA -
testcase_79 AC 42 ms
51,968 KB
testcase_80 AC 42 ms
52,096 KB
testcase_81 AC 42 ms
51,968 KB
testcase_82 AC 42 ms
52,352 KB
testcase_83 WA -
testcase_84 AC 42 ms
52,224 KB
testcase_85 AC 42 ms
52,352 KB
testcase_86 AC 42 ms
51,968 KB
testcase_87 AC 43 ms
52,096 KB
testcase_88 AC 42 ms
51,968 KB
testcase_89 AC 42 ms
52,096 KB
testcase_90 AC 42 ms
52,096 KB
testcase_91 WA -
testcase_92 AC 43 ms
51,968 KB
testcase_93 AC 42 ms
51,968 KB
testcase_94 AC 46 ms
52,224 KB
testcase_95 AC 41 ms
52,608 KB
testcase_96 AC 42 ms
52,352 KB
testcase_97 AC 42 ms
52,480 KB
testcase_98 AC 42 ms
52,096 KB
testcase_99 AC 42 ms
52,224 KB
testcase_100 AC 42 ms
52,352 KB
testcase_101 AC 41 ms
52,224 KB
testcase_102 AC 41 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

def f(aa, bb):
    x = 0
    for a, b in zip(aa, bb): x ^= a+b
    return x

n = II()
aa = LI()

seen = {}
even = -1
j = -1
for i, a in enumerate(aa):
    if a in seen: 
        j = seen[a]
    else:
        seen[a]=i
    if a & 1 == 0:
        if even == -1:
            even = i
        else:
            j = even
    if j != -1:
        p = [-1]*n
        q = [-1]*n
        # print(i, j)
        p[i] = q[j] = 2
        p[j] = q[i] = 3
        for arr in [p, q]:
            a = 1
            for k in range(n):
                if arr[k] == -1:
                    arr[k] = a
                    if a == 1: a = 4
                    else: a += 1
        # print(f(aa, p), f(aa, q))
        print(*p)
        print(*q)
        exit()

print(-1)
0