結果

問題 No.2254 Reverse Only
ユーザー gew1fw
提出日時 2025-06-12 16:07:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 680 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 82,524 KB
実行使用メモリ 149,272 KB
最終ジャッジ日時 2025-06-12 16:08:06
合計ジャッジ時間 8,560 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 42 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import Counter

def main():
    N, k = map(int, sys.stdin.readline().split())
    A = list(map(int, sys.stdin.readline().split()))
    B = list(map(int, sys.stdin.readline().split()))
    
    if A == B:
        print("Yes")
        return
    
    if k <= 2:
        count_A = Counter(A)
        count_B = Counter(B)
        if count_A == count_B:
            print("Yes")
        else:
            print("No")
        return
    
    if N < k:
        print("No")
        return
    
    count_A = Counter(A)
    count_B = Counter(B)
    if count_A != count_B:
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    main()
0