結果
問題 |
No.2422 regisys?
|
ユーザー |
![]() |
提出日時 | 2023-08-22 02:52:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,063 bytes |
コンパイル時間 | 437 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 148,884 KB |
最終ジャッジ日時 | 2024-12-15 20:03:33 |
合計ジャッジ時間 | 22,401 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 WA * 47 |
ソースコード
import sys input = sys.stdin.readline from operator import itemgetter from heapq import heappop,heappush N,M=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) AB=[] for i in range(N): AB.append((A[i],B[i])) C0=[] C1=[] for i in range(M): t,c=map(int,input().split()) if t==0: C0.append(c) else: C1.append(c) C0.sort() C1.sort() AB.sort(key=itemgetter(1),reverse=True) AB.sort(key=itemgetter(0)) H=[] ind=0 for i in range(len(C0)): c=C0[i] while ind<N and AB[ind][0]<=c: a,b=AB[ind] heappush(H,(-b,a)) ind+=1 #print(H,c) if H: heappop(H) for i in range(ind,N): a,b=AB[ind] heappush(H,(-b,a)) C1rest=[] while H: a,b=heappop(H) C1rest.append(b) C1rest.sort() H=[] ind=0 for i in range(len(C1)): c=C1[i] while ind<len(C1rest) and C1rest[ind]<=c: heappush(H,-C1rest[ind]) ind+=1 if H: heappop(H) for i in range(ind,len(C1rest)): heappush(H,-C1rest[ind]) print(len(H))