結果

問題 No.1708 Quality of Contest
ユーザー chineristACchineristAC
提出日時 2020-09-12 22:00:19
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 330 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 748 ms
コンパイル使用メモリ 81,648 KB
実行使用メモリ 138,812 KB
最終ジャッジ日時 2023-10-17 19:37:37
合計ジャッジ時間 9,731 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,424 KB
testcase_01 AC 36 ms
53,424 KB
testcase_02 AC 36 ms
53,424 KB
testcase_03 AC 56 ms
68,556 KB
testcase_04 AC 55 ms
68,556 KB
testcase_05 AC 55 ms
68,560 KB
testcase_06 AC 54 ms
66,508 KB
testcase_07 AC 57 ms
68,556 KB
testcase_08 AC 37 ms
53,424 KB
testcase_09 AC 289 ms
132,412 KB
testcase_10 AC 199 ms
117,760 KB
testcase_11 AC 284 ms
122,272 KB
testcase_12 AC 303 ms
125,424 KB
testcase_13 AC 261 ms
111,088 KB
testcase_14 AC 298 ms
127,176 KB
testcase_15 AC 328 ms
138,592 KB
testcase_16 AC 330 ms
138,444 KB
testcase_17 AC 295 ms
130,656 KB
testcase_18 AC 314 ms
131,820 KB
testcase_19 AC 314 ms
133,880 KB
testcase_20 AC 296 ms
129,708 KB
testcase_21 AC 314 ms
132,196 KB
testcase_22 AC 307 ms
128,092 KB
testcase_23 AC 330 ms
138,812 KB
testcase_24 AC 205 ms
123,492 KB
testcase_25 AC 205 ms
124,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.readline

N,M,X = map(int,input().split())
Genre = [[] for i in range(M)]
for _ in range(N):
    v,g = map(int,input().split())
    Genre[g-1].append(v)

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

problem = []
for i in range(M):
    if Genre[i]:
        Genre[i].sort(reverse=True)
        Genre[i][0] += X
        problem += Genre[i]

problem.sort(reverse=True)
problem = [0] + problem
for i in range(1,N+1):
    problem[i] += problem[i-1]

ans = 0
for AC in p:
    ans += problem[AC]

print(ans)
0