結果
問題 |
No.2732 Similar Permutations
|
ユーザー |
|
提出日時 | 2024-04-19 22:04:43 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 599 bytes |
コンパイル時間 | 319 ms |
コンパイル使用メモリ | 82,500 KB |
実行使用メモリ | 111,536 KB |
最終ジャッジ日時 | 2024-10-11 15:15:02 |
合計ジャッジ時間 | 27,604 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 57 WA * 44 |
ソースコード
import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd n = int(input()) a = list(map(int,input().split())) x = [[] for i in range(max(a)+10)] for i in range(n): x[a[i]].append(i) p1 = list(range(1, n+1)) p2 = list(range(1, n+1)) for i in range(max(a)+10): if len(x[i]) >= 2: s,t = x[i][0], x[i][1] p2[t], p2[s] = p2[s], p2[t] break if p1 == p2: print(-1) else: print(*p1) print(*p2)