結果
| 問題 |
No.2732 Similar Permutations
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-09 07:18:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 676 bytes |
| コンパイル時間 | 2,816 ms |
| コンパイル使用メモリ | 81,664 KB |
| 実行使用メモリ | 510,712 KB |
| 最終ジャッジ日時 | 2024-10-01 17:09:18 |
| 合計ジャッジ時間 | 42,738 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 WA * 61 TLE * 1 -- * 3 |
ソースコード
from itertools import permutations from collections import defaultdict N = int(input()) A = list(map(int, input().split())) if N <= 10: d = defaultdict(list) for p in permutations(list(range(1, N + 1))): x = 0 for i in range(N): x ^= A[i] + p[i] d[x].append(p) for c, ps in d.items(): if len(ps) >= 2: print(*ps[0]) print(*ps[1]) exit() exit(print(-1)) P = list(range(1, N + 1)) x = 0 for i in range(N): x ^= A[i] + i + 1 ax = 0 for i in range(10, N): ax ^= A[i] + (i + 1) for p in permutations(list(range(1, 11))): nx = 0 for i in range(10): nx ^= A[i] + p[i] if x == ax ^ nx: print(*P) print(*(list(p) + list(range(11, N + 1)))) exit()