結果

問題 No.2422 regisys?
ユーザー sepa38sepa38
提出日時 2023-07-15 14:47:51
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 970 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 154,564 KB
最終ジャッジ日時 2023-10-16 23:59:26
合計ジャッジ時間 36,400 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,588 KB
testcase_01 AC 36 ms
53,588 KB
testcase_02 RE -
testcase_03 AC 36 ms
53,588 KB
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 36 ms
53,588 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 35 ms
53,588 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 37 ms
53,588 KB
testcase_16 RE -
testcase_17 AC 35 ms
53,588 KB
testcase_18 RE -
testcase_19 WA -
testcase_20 RE -
testcase_21 AC 34 ms
53,588 KB
testcase_22 RE -
testcase_23 AC 39 ms
55,636 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 38 ms
53,588 KB
testcase_31 RE -
testcase_32 WA -
testcase_33 RE -
testcase_34 WA -
testcase_35 RE -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 365 ms
85,524 KB
testcase_40 RE -
testcase_41 WA -
testcase_42 RE -
testcase_43 AC 846 ms
99,208 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 WA -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 WA -
testcase_57 TLE -
testcase_58 AC 1,959 ms
153,700 KB
testcase_59 TLE -
testcase_60 TLE -
testcase_61 AC 35 ms
53,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a2 = [[a[i], i] for i in range(n)]
b2 = [[b[i], i] for i in range(n)]
a2.sort()
b2.sort()
ls = [list(map(int, input().split())) for _ in range(n)]
ls.sort(key = lambda x: x[1])
flg = [0] * n
h1 = []
h2 = []
idxa = 0
idxb = 0
for t, c in ls:
  while idxa < n:
    if a2[idxa][0] > c:
      break
    heapq.heappush(h1, (-a2[idxa][0])*n+a2[idxa][1])
    idxa += 1
  while idxb < n:
    if b2[idxb][0] > c:
      break
    heapq.heappush(h2, (-b2[idxb][0])*n+b2[idxb][1])
    idxb += 1
  if t:
    while h2:
      tmp = heapq.heappop(h2)
      x, i = divmod(tmp, n)
      x *= -1
      if flg[i] == 0:
        flg[i] = 1
        break
  else:
    while h1:
      tmp = heapq.heappop(h1)
      x, i = divmod(tmp, n)
      x *= -1
      if flg[i] == 0:
        flg[i] = 1
        break
  # print(flg, t, c)
  # print(h1, h2)
print(n - sum(flg))
# print(flg)
0