結果
| 問題 | No.2422 regisys? |
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2023-08-12 14:58:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 693 bytes |
| 記録 | |
| コンパイル時間 | 436 ms |
| コンパイル使用メモリ | 82,168 KB |
| 実行使用メモリ | 138,284 KB |
| 最終ジャッジ日時 | 2024-11-19 22:27:58 |
| 合計ジャッジ時間 | 22,007 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 WA * 42 |
ソースコード
from sys import stdin
input=lambda :stdin.readline()[:-1]
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
t0=[]
t1=[]
for i in range(m):
t,c=map(int,input().split())
if t:
t1.append(c)
else:
t0.append(c)
t0.sort()
t1.sort()
from heapq import heappop, heappush
ab=[]
for i in range(n):
ab.append([a[i],b[i]])
ab.sort()
idx=0
hq=[]
ans=0
for c in t0:
while idx!=n and ab[idx][0]<=c:
heappush(hq,-ab[idx][1])
idx+=1
if hq:
ans+=1
heappop(hq)
while idx!=n:
heappush(hq,-ab[i][1])
idx+=1
hq2=[]
for i in hq:
heappush(hq2,-i)
for c in t1:
if hq2 and hq2[0]<=c:
heappop(hq2)
ans+=1
print(n-ans)
とりゐ