結果

問題 No.2422 regisys?
ユーザー gew1fw
提出日時 2025-06-12 14:45:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,121 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,908 KB
実行使用メモリ 187,628 KB
最終ジャッジ日時 2025-06-12 14:47:45
合計ジャッジ時間 10,568 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 28 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def main():
    input = sys.stdin.read().split()
    ptr = 0
    N = int(input[ptr])
    ptr += 1
    M = int(input[ptr])
    ptr += 1

    A = list(map(int, input[ptr:ptr+N]))
    ptr += N
    B = list(map(int, input[ptr:ptr+N]))
    ptr += N

    regular = []
    mma = []
    for _ in range(M):
        T = int(input[ptr])
        ptr += 1
        C = int(input[ptr])
        ptr += 1
        if T == 0:
            regular.append(C)
        else:
            mma.append(C)

    def max_sell(group_prices, customers):
        group_prices.sort()
        customers.sort()
        m = len(customers)
        n = len(group_prices)
        i = j = count = 0
        while i < n and j < m:
            if group_prices[i] <= customers[j]:
                count += 1
                i += 1
                j += 1
            else:
                j += 1
        return count

    reg_prices = A
    mma_prices = B

    r_count = max_sell(reg_prices, regular)
    m_count = max_sell(mma_prices, mma)

    total = r_count + m_count
    min_left = N - total
    print(min_left)

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