結果

問題 No.2422 regisys?
ユーザー rlangevinrlangevin
提出日時 2023-09-03 17:03:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,166 bytes
コンパイル時間 624 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 139,220 KB
最終ジャッジ日時 2023-09-03 17:04:20
合計ジャッジ時間 49,107 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,560 KB
testcase_01 AC 99 ms
71,648 KB
testcase_02 AC 101 ms
71,772 KB
testcase_03 WA -
testcase_04 AC 99 ms
71,444 KB
testcase_05 AC 99 ms
71,444 KB
testcase_06 AC 99 ms
71,708 KB
testcase_07 AC 98 ms
71,708 KB
testcase_08 AC 100 ms
71,500 KB
testcase_09 AC 100 ms
71,672 KB
testcase_10 AC 101 ms
71,328 KB
testcase_11 WA -
testcase_12 AC 100 ms
71,536 KB
testcase_13 AC 106 ms
71,824 KB
testcase_14 AC 100 ms
71,556 KB
testcase_15 WA -
testcase_16 AC 102 ms
71,584 KB
testcase_17 AC 98 ms
71,672 KB
testcase_18 AC 100 ms
71,700 KB
testcase_19 AC 98 ms
71,684 KB
testcase_20 AC 102 ms
71,352 KB
testcase_21 AC 102 ms
71,348 KB
testcase_22 AC 101 ms
71,564 KB
testcase_23 AC 100 ms
71,588 KB
testcase_24 AC 103 ms
71,684 KB
testcase_25 AC 100 ms
71,784 KB
testcase_26 AC 99 ms
71,588 KB
testcase_27 AC 98 ms
71,684 KB
testcase_28 AC 101 ms
71,744 KB
testcase_29 AC 102 ms
71,648 KB
testcase_30 AC 102 ms
71,476 KB
testcase_31 AC 844 ms
99,364 KB
testcase_32 AC 735 ms
92,544 KB
testcase_33 AC 866 ms
99,624 KB
testcase_34 AC 317 ms
82,768 KB
testcase_35 AC 1,098 ms
110,608 KB
testcase_36 AC 518 ms
89,796 KB
testcase_37 AC 842 ms
97,904 KB
testcase_38 AC 391 ms
87,176 KB
testcase_39 AC 300 ms
85,124 KB
testcase_40 AC 504 ms
89,228 KB
testcase_41 AC 372 ms
87,188 KB
testcase_42 TLE -
testcase_43 AC 711 ms
92,196 KB
testcase_44 TLE -
testcase_45 AC 1,839 ms
120,436 KB
testcase_46 TLE -
testcase_47 AC 1,082 ms
106,000 KB
testcase_48 TLE -
testcase_49 WA -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 AC 912 ms
104,284 KB
testcase_53 TLE -
testcase_54 TLE -
testcase_55 TLE -
testcase_56 AC 1,250 ms
111,420 KB
testcase_57 TLE -
testcase_58 TLE -
testcase_59 TLE -
testcase_60 TLE -
testcase_61 AC 100 ms
71,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
D = []
for i in range(N):
    D.append([A[i], B[i], 0])
L = [[-1], [-1]]
for i in range(M):
    T, C = map(int, input().split())
    L[T].append(C)
    
D.sort(reverse=True)
L[0].sort()
L[1].sort()
for i in range(N):
    if D[i][0] <= L[0][-1]:
        D[i][2] += 1
        L[0].pop()
        
for i in range(N):
    D[i][0], D[i][1] = D[i][1], D[i][0]
        
D.sort(reverse=True)
for i in range(N):
    if D[i][0] <= L[1][-1]:
        D[i][2] += 1
        L[1].pop()

from collections import *
ans = 0
cnt = 0
ind = deque()
for i in range(N):
    if D[i][2] == 2:
        ind.append(i)
    elif D[i][2] == 1:
        continue
    else:
        if ind:
            D[ind.popleft()][2] -= 1
            D[i][2] += 1


for i in range(N):
    D[i][0], D[i][1] = D[i][1], D[i][0]
        
D.sort(reverse=True)
ans = 0
cnt = 0
for i in range(N):
    if D[i][2] == 2:
        ans += 1
        cnt += 1
    elif D[i][2] == 1:
        ans += 1
    else:
        if cnt:
            ans += 1
            cnt -= 1

print(N - ans)
0