結果

問題 No.2254 Reverse Only
ユーザー gew1fw
提出日時 2025-06-12 14:31:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,724 KB
実行使用メモリ 149,552 KB
最終ジャッジ日時 2025-06-12 14:32:06
合計ジャッジ時間 9,591 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 42 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict

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()))
    
    # 检查多集合是否相同
    count_a = defaultdict(int)
    count_b = defaultdict(int)
    for a in A:
        count_a[a] += 1
    for b in B:
        count_b[b] += 1
    if count_a != count_b:
        print("No")
        return
    
    if k == 1:
        print("Yes")
        return
    if k > n:
        if A == B:
            print("Yes")
        else:
            print("No")
        return
    else:
        print("Yes")
        return

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