結果

問題 No.2254 Reverse Only
ユーザー sotanishy
提出日時 2023-03-24 21:48:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 362 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 115,252 KB
最終ジャッジ日時 2024-09-18 17:00:04
合計ジャッジ時間 7,809 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 42 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if sorted(A) != sorted(B):
    print("No")
elif A == B:
    print("Yes")
elif k > N:
    print("No")
elif k <= N-1:
    # rotation + swap
    print("Yes")
else:
    # k == N
    print("Yes" if A[::-1] == B else "No")
0