結果
| 問題 |
No.1779 Magical Swap
|
| コンテスト | |
| ユーザー |
Wizist
|
| 提出日時 | 2021-12-12 22:55:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 417 bytes |
| コンパイル時間 | 278 ms |
| コンパイル使用メモリ | 81,848 KB |
| 実行使用メモリ | 103,468 KB |
| 最終ジャッジ日時 | 2024-07-21 11:24:09 |
| 合計ジャッジ時間 | 3,220 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 WA * 8 |
ソースコード
import math
def lcm(x, y): return x * y // math.gcd(x, y)
ncases = int(input())
for caseno in range(ncases):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
def check():
if a[0] != b[0]: return False
for i in range(1, len(a)):
if a[i] == b[i]: continue
if lcm(i + 1, 2) > n: return False
a.sort(); b.sort()
return a == b
print("Yes" if check() else "No")
Wizist