結果
問題 | No.2732 Similar Permutations |
ユーザー |
![]() |
提出日時 | 2024-04-19 22:46:41 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,478 bytes |
コンパイル時間 | 250 ms |
コンパイル使用メモリ | 82,448 KB |
実行使用メモリ | 114,964 KB |
最終ジャッジ日時 | 2024-10-11 16:37:27 |
合計ジャッジ時間 | 22,752 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 84 WA * 17 |
ソースコード
import sys# sys.setrecursionlimit(200005)# sys.set_int_max_str_digits(200005)int1 = lambda x: int(x)-1pDB = lambda *x: print(*x, end="\n", file=sys.stderr)p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)def II(): return int(sys.stdin.readline())def LI(): return list(map(int, sys.stdin.readline().split()))def LLI(rows_number): return [LI() for _ in range(rows_number)]def LI1(): return list(map(int1, sys.stdin.readline().split()))def LLI1(rows_number): return [LI1() for _ in range(rows_number)]def SI(): return sys.stdin.readline().rstrip()dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]# inf = -1-(-1 << 31)inf = -1-(-1 << 62)# md = 10**9+7md = 998244353def f(aa, bb):x = 0for a, b in zip(aa, bb): x ^= a+breturn xn = II()aa = LI()seen = {}even = -1j = -1for i, a in enumerate(aa):if a in seen: j = seen[a]if a & 1 == 0:if even == -1:even = ielse:j = evenif j != -1:p = [-1]*nq = [-1]*n# print(i, j)p[i] = q[j] = 2p[j] = q[i] = 3for arr in [p, q]:a = 1for k in range(n):if arr[k] == -1:arr[k] = aif a == 1: a = 4else: a += 1# print(f(aa, p), f(aa, q))print(*p)print(*q)exit()print(-1)