結果
| 問題 | No.2422 regisys? |
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2023-08-12 14:59:33 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 622 ms / 2,000 ms |
| + 435µs | |
| コード長 | 695 bytes |
| 記録 | |
| コンパイル時間 | 602 ms |
| コンパイル使用メモリ | 65,124 KB |
| 実行使用メモリ | 109,360 KB |
| 最終ジャッジ日時 | 2026-10-20 18:31:15 |
| 合計ジャッジ時間 | 21,775 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge6_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 62 |
ソースコード
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[idx][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)
とりゐ