結果

問題 No.2422 regisys?
ユーザー gr1msl3ygr1msl3y
提出日時 2023-08-16 16:03:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 713 ms / 2,000 ms
コード長 754 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 132,772 KB
最終ジャッジ日時 2024-05-04 00:12:09
合計ジャッジ時間 16,981 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,224 KB
testcase_01 AC 37 ms
53,120 KB
testcase_02 AC 37 ms
52,736 KB
testcase_03 AC 38 ms
52,736 KB
testcase_04 AC 39 ms
52,736 KB
testcase_05 AC 43 ms
53,376 KB
testcase_06 AC 39 ms
53,888 KB
testcase_07 AC 42 ms
53,504 KB
testcase_08 AC 39 ms
53,632 KB
testcase_09 AC 36 ms
53,096 KB
testcase_10 AC 40 ms
52,992 KB
testcase_11 AC 39 ms
53,376 KB
testcase_12 AC 39 ms
52,736 KB
testcase_13 AC 43 ms
53,760 KB
testcase_14 AC 40 ms
52,864 KB
testcase_15 AC 41 ms
53,248 KB
testcase_16 AC 40 ms
52,736 KB
testcase_17 AC 41 ms
53,376 KB
testcase_18 AC 40 ms
52,608 KB
testcase_19 AC 42 ms
53,632 KB
testcase_20 AC 44 ms
54,016 KB
testcase_21 AC 44 ms
53,376 KB
testcase_22 AC 42 ms
52,992 KB
testcase_23 AC 43 ms
53,376 KB
testcase_24 AC 40 ms
52,992 KB
testcase_25 AC 35 ms
53,376 KB
testcase_26 AC 35 ms
52,608 KB
testcase_27 AC 37 ms
52,992 KB
testcase_28 AC 40 ms
53,376 KB
testcase_29 AC 36 ms
52,736 KB
testcase_30 AC 37 ms
53,248 KB
testcase_31 AC 309 ms
95,976 KB
testcase_32 AC 322 ms
91,756 KB
testcase_33 AC 291 ms
95,980 KB
testcase_34 AC 227 ms
81,320 KB
testcase_35 AC 325 ms
97,152 KB
testcase_36 AC 250 ms
87,396 KB
testcase_37 AC 374 ms
97,408 KB
testcase_38 AC 233 ms
83,968 KB
testcase_39 AC 193 ms
80,896 KB
testcase_40 AC 247 ms
87,552 KB
testcase_41 AC 216 ms
82,816 KB
testcase_42 AC 498 ms
107,380 KB
testcase_43 AC 285 ms
91,520 KB
testcase_44 AC 562 ms
110,596 KB
testcase_45 AC 451 ms
102,288 KB
testcase_46 AC 568 ms
113,352 KB
testcase_47 AC 407 ms
96,896 KB
testcase_48 AC 514 ms
132,224 KB
testcase_49 AC 443 ms
97,560 KB
testcase_50 AC 456 ms
132,520 KB
testcase_51 AC 581 ms
116,072 KB
testcase_52 AC 264 ms
98,688 KB
testcase_53 AC 511 ms
107,256 KB
testcase_54 AC 509 ms
132,772 KB
testcase_55 AC 448 ms
108,152 KB
testcase_56 AC 338 ms
98,028 KB
testcase_57 AC 713 ms
132,192 KB
testcase_58 AC 689 ms
132,304 KB
testcase_59 AC 692 ms
132,348 KB
testcase_60 AC 701 ms
132,164 KB
testcase_61 AC 35 ms
52,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq as hq
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
task = [[] for _ in range(2)]
for _ in range(M):
    t, v = map(int, input().split())
    task[t].append(v)

for i in range(2):
    task[i].sort()

state = []
seen = [0]*N
Aind = sorted(list(range(N)), key=lambda x: A[x])
ind = 0
for v in task[0]:
    while ind < N and v >= A[Aind[ind]]:
        hq.heappush(state, [-B[Aind[ind]], Aind[ind]])
        ind += 1
    if state:
        w, t = hq.heappop(state)
        seen[t] = 1

ans = N-sum(seen)
Bval = [B[i] for i in range(N) if not seen[i]]
Bval.sort()
ind = 0
for i, v in enumerate(task[1]):
    if Bval and v >= Bval[0]:
        hq.heappop(Bval)
        ans -= 1

print(ans)
0