結果

問題 No.3750 Mischievous Resident (Easy)
コンテスト
ユーザー kidodesu
提出日時 2026-10-02 21:30:55
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 667 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 61 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 152,892 KB
最終ジャッジ日時 2026-10-02 21:31:08
合計ジャッジ時間 10,992 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    n, m = list(map(int, input().split()))
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = [(a, b) for a, b in zip(A, B)]
    C.sort()
    T = []
    for i in range(m):
        if C[i][0] == C[i][1]:
            if T:
                if sorted(T) == T and len(T) == len(set(T)):
                    return "Yes"
                else:
                    return "No"
            T = []
            continue
        T.append(C[i][1])
    if T:
        if sorted(T) == T and len(T) == len(set(T)):
            return "Yes"
    else:
        return "Yes"
    return "No"

for _ in range(int(input())):
    print(main())
0