結果

問題 No.2254 Reverse Only
ユーザー gew1fw
提出日時 2025-06-12 16:09:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 116,352 KB
最終ジャッジ日時 2025-06-12 16:09:21
合計ジャッジ時間 7,911 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 39 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

# Check if a and b are permutations of each other
if sorted(a) != sorted(b):
    print("No")
else:
    if k > n:
        # Can't perform any operation. Check if a equals b
        if a == b:
            print("Yes")
        else:
            print("No")
    else:
        if k <= 2:
            print("Yes")
        else:
            if n >= k + 1:
                print("Yes")
            else:
                print("No")
0