結果

問題 No.2254 Reverse Only
ユーザー lam6er
提出日時 2025-04-16 15:59:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 81,948 KB
実行使用メモリ 149,928 KB
最終ジャッジ日時 2025-04-16 16:01:09
合計ジャッジ時間 8,647 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if k == 1:
    if Counter(a) == Counter(b):
        print("Yes")
    else:
        print("No")
else:
    if Counter(a) != Counter(b):
        print("No")
    else:
        if k % 2 == 0:
            print("Yes")
        else:
            if n >= k + 1:
                print("Yes")
            else:
                reversed_a = a[::-1]
                if b == a or b == reversed_a:
                    print("Yes")
                else:
                    print("No")
0