結果
| 問題 |
No.2732 Similar Permutations
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-09 07:16:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 670 bytes |
| コンパイル時間 | 361 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 532,192 KB |
| 最終ジャッジ日時 | 2024-10-01 17:08:32 |
| 合計ジャッジ時間 | 36,569 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 RE * 61 MLE * 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(*(p + list(range(11, N + 1)))) exit()