結果

問題 No.2732 Similar Permutations
コンテスト
ユーザー detteiuu
提出日時 2026-07-19 15:52:03
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 559 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 225 ms
コンパイル使用メモリ 95,864 KB
実行使用メモリ 830,168 KB
最終ジャッジ日時 2026-07-19 15:55:05
合計ジャッジ時間 168,247 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36 TLE * 64 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import permutations

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

B = list(range(1, min(N, 10)+1))
C = [[] for _ in range(10**6*5)]
for perm in permutations(B):
    SUM = 0
    for i, p in enumerate(perm):
        SUM ^= A[i]+p
    C[SUM].append(perm)

for i in range(10**6*5):
    if 2 <= len(C[i]):
        ans1 = list(C[i][0])
        ans2 = list(C[i][1])
        if 10 < N:
            ans1 += list(range(11, N+1))
            ans2 += list(range(11, N+1))
        print(*ans1)
        print(*ans2)
        break
else:
    print(-1)
0