結果

問題 No.2422 regisys?
コンテスト
ユーザー ああ
提出日時 2026-05-19 19:59:56
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 563 ms / 2,000 ms
コード長 625 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 216 ms
コンパイル使用メモリ 84,736 KB
実行使用メモリ 117,956 KB
最終ジャッジ日時 2026-05-19 20:00:18
合計ジャッジ時間 18,559 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
純コード判定待ち
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import heapq

n,m=map(int,input().split())
hq=[];hq2=[]
for i,j in zip(list(map(int,input().split())),list(map(int,input().split()))):
    heapq.heappush(hq,(i,j))
x,y=[],[]
for i in range(m):
    a,b=map(int,input().split())
    c=x if a else y
    c.append(b)
y.sort();x.sort()
for i in y:
    while hq and hq[0][0]<=i:
        a,b=heapq.heappop(hq)
        heapq.heappush(hq2,-b)
    if hq2:
        heapq.heappop(hq2);n-=1
hq3=[]
while hq:
    a,b=heapq.heappop(hq);heapq.heappush(hq3,b)
while hq2:
    heapq.heappush(hq3,-heapq.heappop(hq2))
for i in x:
    if hq3 and hq3[0]<=i:
        n-=1;heapq.heappop(hq3)
print(n)
0