結果

問題 No.1708 Quality of Contest
ユーザー chineristACchineristAC
提出日時 2020-09-13 01:59:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 794 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 11,724 KB
実行使用メモリ 59,676 KB
最終ジャッジ日時 2023-10-17 19:39:19
合計ジャッジ時間 13,532 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
9,956 KB
testcase_01 AC 30 ms
9,956 KB
testcase_02 AC 29 ms
9,956 KB
testcase_03 AC 39 ms
10,944 KB
testcase_04 AC 40 ms
10,880 KB
testcase_05 AC 38 ms
10,876 KB
testcase_06 AC 38 ms
10,820 KB
testcase_07 AC 37 ms
10,760 KB
testcase_08 AC 29 ms
9,956 KB
testcase_09 AC 752 ms
59,676 KB
testcase_10 AC 597 ms
53,768 KB
testcase_11 AC 648 ms
45,532 KB
testcase_12 AC 680 ms
46,808 KB
testcase_13 AC 612 ms
43,768 KB
testcase_14 AC 699 ms
49,116 KB
testcase_15 AC 794 ms
56,192 KB
testcase_16 AC 788 ms
55,380 KB
testcase_17 AC 691 ms
49,392 KB
testcase_18 AC 702 ms
51,152 KB
testcase_19 AC 727 ms
52,116 KB
testcase_20 AC 709 ms
50,148 KB
testcase_21 AC 721 ms
51,496 KB
testcase_22 AC 702 ms
48,200 KB
testcase_23 AC 787 ms
56,716 KB
testcase_24 AC 527 ms
40,432 KB
testcase_25 AC 530 ms
40,372 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