結果
問題 | No.1779 Magical Swap |
ユーザー | Wizist |
提出日時 | 2021-12-12 22:55:44 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 417 bytes |
コンパイル時間 | 860 ms |
コンパイル使用メモリ | 86,908 KB |
実行使用メモリ | 100,916 KB |
最終ジャッジ日時 | 2023-09-28 16:41:54 |
合計ジャッジ時間 | 4,393 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,396 KB |
testcase_01 | AC | 74 ms
71,556 KB |
testcase_02 | AC | 186 ms
77,840 KB |
testcase_03 | WA | - |
testcase_04 | AC | 110 ms
95,568 KB |
testcase_05 | AC | 94 ms
84,180 KB |
testcase_06 | AC | 92 ms
85,768 KB |
testcase_07 | AC | 109 ms
96,536 KB |
testcase_08 | AC | 76 ms
75,664 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 464 ms
78,520 KB |
testcase_16 | AC | 116 ms
94,332 KB |
testcase_17 | WA | - |
testcase_18 | AC | 77 ms
71,572 KB |
ソースコード
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")