結果

問題 No.1708 Quality of Contest
ユーザー shinichishinichi
提出日時 2021-10-16 01:08:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 408 ms / 2,000 ms
コード長 541 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 81,724 KB
実行使用メモリ 150,868 KB
最終ジャッジ日時 2023-10-17 21:57:40
合計ジャッジ時間 8,761 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,500 KB
testcase_01 AC 42 ms
55,500 KB
testcase_02 AC 43 ms
55,500 KB
testcase_03 AC 90 ms
76,756 KB
testcase_04 AC 89 ms
77,040 KB
testcase_05 AC 97 ms
76,864 KB
testcase_06 AC 86 ms
76,684 KB
testcase_07 AC 89 ms
76,708 KB
testcase_08 AC 41 ms
53,452 KB
testcase_09 AC 328 ms
150,868 KB
testcase_10 AC 270 ms
119,504 KB
testcase_11 AC 394 ms
134,876 KB
testcase_12 AC 398 ms
141,316 KB
testcase_13 AC 387 ms
117,024 KB
testcase_14 AC 402 ms
134,184 KB
testcase_15 AC 395 ms
134,432 KB
testcase_16 AC 402 ms
133,296 KB
testcase_17 AC 394 ms
140,472 KB
testcase_18 AC 398 ms
142,428 KB
testcase_19 AC 408 ms
138,776 KB
testcase_20 AC 402 ms
140,112 KB
testcase_21 AC 396 ms
125,800 KB
testcase_22 AC 396 ms
142,524 KB
testcase_23 AC 394 ms
134,016 KB
testcase_24 AC 305 ms
132,864 KB
testcase_25 AC 301 ms
132,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from itertools import accumulate



N, M, X = map(int, input().split())
data = []
dic = defaultdict(list)
for _ in range(N):
    a, b = map(int, input().split())
    dic[b].append(a)

for k, v in dic.items():
    values = sorted(v, reverse=True)
    data.append(values[0]+X)
    for i in range(1, len(values)):
        data.append(values[i])
data.sort(reverse=True)
data = [0] + list(accumulate(data))
K = int(input())
C = list(map(int, input().split()))

ans = 0
for c in C:
    ans += data[c]
print(ans)
0