結果

問題 No.2422 regisys?
ユーザー とりゐとりゐ
提出日時 2023-08-12 14:58:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 693 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 138,560 KB
最終ジャッジ日時 2024-04-30 07:41:55
合計ジャッジ時間 18,540 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,340 KB
testcase_01 AC 34 ms
54,460 KB
testcase_02 AC 34 ms
53,812 KB
testcase_03 WA -
testcase_04 AC 34 ms
53,320 KB
testcase_05 AC 34 ms
53,876 KB
testcase_06 AC 34 ms
54,444 KB
testcase_07 AC 33 ms
53,252 KB
testcase_08 AC 36 ms
54,020 KB
testcase_09 AC 34 ms
53,344 KB
testcase_10 AC 36 ms
53,488 KB
testcase_11 WA -
testcase_12 AC 32 ms
53,252 KB
testcase_13 WA -
testcase_14 AC 34 ms
53,612 KB
testcase_15 WA -
testcase_16 AC 38 ms
53,488 KB
testcase_17 AC 39 ms
53,664 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 39 ms
53,892 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
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 AC 367 ms
101,100 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 623 ms
111,380 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 712 ms
115,692 KB
testcase_49 WA -
testcase_50 AC 664 ms
112,212 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 AC 35 ms
54,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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