結果

問題 No.2422 regisys?
ユーザー titiatitia
提出日時 2023-08-22 02:52:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 147,276 KB
最終ジャッジ日時 2023-08-22 02:53:08
合計ジャッジ時間 26,213 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,548 KB
testcase_01 WA -
testcase_02 AC 81 ms
75,492 KB
testcase_03 WA -
testcase_04 AC 79 ms
71,356 KB
testcase_05 AC 95 ms
71,460 KB
testcase_06 AC 76 ms
71,448 KB
testcase_07 AC 76 ms
71,360 KB
testcase_08 AC 76 ms
71,492 KB
testcase_09 WA -
testcase_10 AC 78 ms
71,220 KB
testcase_11 WA -
testcase_12 AC 76 ms
71,352 KB
testcase_13 WA -
testcase_14 AC 77 ms
71,208 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 88 ms
71,100 KB
testcase_18 AC 77 ms
71,632 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 75 ms
71,412 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 74 ms
71,524 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 884 ms
138,276 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0