結果

問題 No.1708 Quality of Contest
ユーザー roarisroaris
提出日時 2021-10-17 20:27:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 146,156 KB
最終ジャッジ日時 2023-10-17 22:33:33
合計ジャッジ時間 6,918 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,472 KB
testcase_01 AC 42 ms
53,472 KB
testcase_02 AC 43 ms
55,520 KB
testcase_03 AC 65 ms
68,712 KB
testcase_04 AC 61 ms
70,796 KB
testcase_05 AC 62 ms
70,796 KB
testcase_06 AC 59 ms
68,748 KB
testcase_07 AC 60 ms
68,748 KB
testcase_08 AC 41 ms
53,484 KB
testcase_09 AC 266 ms
140,888 KB
testcase_10 AC 197 ms
125,924 KB
testcase_11 AC 286 ms
135,792 KB
testcase_12 AC 298 ms
141,376 KB
testcase_13 AC 284 ms
128,320 KB
testcase_14 AC 305 ms
145,112 KB
testcase_15 AC 307 ms
137,388 KB
testcase_16 AC 310 ms
138,780 KB
testcase_17 AC 289 ms
140,652 KB
testcase_18 AC 297 ms
142,856 KB
testcase_19 AC 301 ms
146,156 KB
testcase_20 AC 298 ms
139,016 KB
testcase_21 AC 303 ms
138,272 KB
testcase_22 AC 301 ms
136,724 KB
testcase_23 AC 315 ms
137,980 KB
testcase_24 AC 212 ms
114,380 KB
testcase_25 AC 216 ms
115,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, M, X = map(int, input().split())
d = defaultdict(list)

for _ in range(N):
    A, B = map(int, input().split())
    d[B].append(A)

l = []

for k in d:
    d[k].sort()
    d[k][-1] += X
    l += d[k]

l.sort(reverse=True)
acc = [0]

for li in l:
    acc.append(acc[-1]+li)

K = int(input())
C = list(map(int, input().split()))
ans = 0

for Ci in C:
    ans += acc[Ci]

print(ans)
0