結果

問題 No.1708 Quality of Contest
ユーザー wolgnikwolgnik
提出日時 2021-10-15 21:38:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 787 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 135,628 KB
最終ジャッジ日時 2023-10-17 20:07:28
合計ジャッジ時間 14,447 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,492 KB
testcase_01 AC 38 ms
53,492 KB
testcase_02 AC 39 ms
53,492 KB
testcase_03 AC 115 ms
77,568 KB
testcase_04 AC 130 ms
77,524 KB
testcase_05 AC 139 ms
77,852 KB
testcase_06 AC 109 ms
77,288 KB
testcase_07 AC 110 ms
77,392 KB
testcase_08 AC 40 ms
53,492 KB
testcase_09 AC 480 ms
134,968 KB
testcase_10 AC 683 ms
134,464 KB
testcase_11 AC 787 ms
134,692 KB
testcase_12 AC 712 ms
134,612 KB
testcase_13 AC 758 ms
134,508 KB
testcase_14 AC 712 ms
134,656 KB
testcase_15 AC 637 ms
135,512 KB
testcase_16 AC 646 ms
135,348 KB
testcase_17 AC 756 ms
134,780 KB
testcase_18 AC 730 ms
134,912 KB
testcase_19 AC 723 ms
134,460 KB
testcase_20 AC 740 ms
135,628 KB
testcase_21 AC 745 ms
134,708 KB
testcase_22 AC 711 ms
133,696 KB
testcase_23 AC 695 ms
134,408 KB
testcase_24 AC 714 ms
132,892 KB
testcase_25 AC 750 ms
134,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N, M, X = map(int, input().split())
a = [tuple(map(int, input().split())) for _ in range(N)]

import heapq
hpush = heapq.heappush
hpop = heapq.heappop

h = []
table = [0] * (M + 1)
for x, y in a: hpush(h, (-(x + X), y))

K = int(input())
qs = list(map(int, input().split()))

qc = [0] * (N + 2)
for x in qs: qc[x + 1] -= 1
qc[1] += K
for i in range(N + 1): qc[i + 1] += qc[i]
#print(qc)

res = 0
for i in range(1, N + 1):
  while table[h[0][1]] == 1:
    x, y = hpop(h)
    hpush(h, (x + X, 0))
  x, y = hpop(h)
  if y: table[y] = 1
  x = -x
  res += x * qc[i]
  #print(x, y)
print(res)
0