結果

問題 No.1708 Quality of Contest
ユーザー tcltktcltk
提出日時 2021-10-16 18:48:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 442 ms / 2,000 ms
コード長 785 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 157,948 KB
最終ジャッジ日時 2023-10-17 22:15:53
合計ジャッジ時間 10,338 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
86,048 KB
testcase_01 AC 125 ms
86,044 KB
testcase_02 AC 126 ms
86,044 KB
testcase_03 AC 152 ms
89,036 KB
testcase_04 AC 151 ms
89,012 KB
testcase_05 AC 150 ms
88,968 KB
testcase_06 AC 149 ms
88,996 KB
testcase_07 AC 154 ms
89,016 KB
testcase_08 AC 126 ms
86,088 KB
testcase_09 AC 389 ms
157,312 KB
testcase_10 AC 311 ms
146,956 KB
testcase_11 AC 381 ms
149,572 KB
testcase_12 AC 399 ms
140,276 KB
testcase_13 AC 362 ms
144,216 KB
testcase_14 AC 405 ms
138,624 KB
testcase_15 AC 435 ms
150,468 KB
testcase_16 AC 442 ms
149,276 KB
testcase_17 AC 402 ms
156,804 KB
testcase_18 AC 417 ms
155,204 KB
testcase_19 AC 412 ms
147,556 KB
testcase_20 AC 407 ms
157,948 KB
testcase_21 AC 421 ms
142,044 KB
testcase_22 AC 410 ms
138,404 KB
testcase_23 AC 437 ms
149,708 KB
testcase_24 AC 309 ms
146,596 KB
testcase_25 AC 309 ms
146,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**20


N, M, X = map(int, input().split())
Problem = [list() for _ in range(M)]
for _ in range(N):
    a, b = map(int, input().split())
    b -= 1
    Problem[b].append(a)
A = []
for b in range(M):
    Problem[b].sort(reverse=True)
    if Problem[b]:
        Problem[b][0] += X
    A += Problem[b]
K = int(input())
C = list(map(int, input().split()))

A.sort(reverse=True)
S = [0] + list(itertools.accumulate(A))

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