結果

問題 No.2254 Reverse Only
ユーザー lam6er
提出日時 2025-04-15 22:55:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 81,532 KB
実行使用メモリ 150,180 KB
最終ジャッジ日時 2025-04-15 22:57:15
合計ジャッジ時間 7,688 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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