結果

問題 No.1708 Quality of Contest
ユーザー mkawa2mkawa2
提出日時 2023-02-04 18:29:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 387 ms / 2,000 ms
コード長 1,062 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 157,824 KB
最終ジャッジ日時 2023-09-16 14:58:57
合計ジャッジ時間 10,968 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,720 KB
testcase_01 AC 92 ms
71,660 KB
testcase_02 AC 91 ms
71,780 KB
testcase_03 AC 115 ms
77,764 KB
testcase_04 AC 115 ms
77,868 KB
testcase_05 AC 114 ms
77,616 KB
testcase_06 AC 114 ms
77,824 KB
testcase_07 AC 113 ms
77,880 KB
testcase_08 AC 91 ms
71,476 KB
testcase_09 AC 336 ms
147,696 KB
testcase_10 AC 256 ms
131,864 KB
testcase_11 AC 362 ms
145,072 KB
testcase_12 AC 371 ms
141,704 KB
testcase_13 AC 350 ms
140,892 KB
testcase_14 AC 370 ms
144,364 KB
testcase_15 AC 382 ms
140,296 KB
testcase_16 AC 387 ms
140,536 KB
testcase_17 AC 358 ms
153,964 KB
testcase_18 AC 368 ms
154,544 KB
testcase_19 AC 373 ms
157,824 KB
testcase_20 AC 359 ms
153,148 KB
testcase_21 AC 379 ms
144,048 KB
testcase_22 AC 365 ms
144,036 KB
testcase_23 AC 380 ms
140,828 KB
testcase_24 AC 276 ms
144,572 KB
testcase_25 AC 279 ms
144,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

from collections import defaultdict

n, m, x = LI()
aa = defaultdict(list)
for _ in range(n):
    a, b = LI()
    aa[b].append(a)
k = II()
cc = LI()

sat = []
for b in aa:
    aa[b].sort()
    sat += aa[b]
    sat[-1] += x

sat.sort(reverse=True)
cs = [0]
for s in sat: cs.append(cs[-1]+s)

ans = 0
for c in cc: ans += cs[c]

print(ans)
0