結果
| 問題 |
No.2732 Similar Permutations
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-27 14:49:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 848 bytes |
| コンパイル時間 | 658 ms |
| コンパイル使用メモリ | 82,344 KB |
| 実行使用メモリ | 107,060 KB |
| 最終ジャッジ日時 | 2024-11-15 17:38:45 |
| 合計ジャッジ時間 | 65,095 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 40 WA * 61 |
ソースコード
from itertools import permutations
def solve_less10():
hm = dict()
for p in permutations(range(1,n+1), n):
xor = 0
for i in range(n):
xor ^= p[i] + a[i]
if xor in hm:
print(*hm[xor])
print(*p)
exit()
hm[xor] = p
print(-1)
def solve_more10():
xor_base = 0
for i in range(11, n):
xor_base ^= i + a[i]
hm = dict()
for p in permutations(range(1,11), 10):
xor = 0
for i in range(10):
xor ^= p[i] + a[i]
if xor_base ^ xor in hm:
print(*(hm[xor] + tuple(range(11, n))))
print(*(p + tuple(range(11, n))))
exit()
hm[xor] = p
print(-1)
n = int(input())
a = list(map(int, input().split()))
if n <= 10:
solve_less10()
else:
solve_more10()