結果

問題 No.1708 Quality of Contest
ユーザー mahiro72
提出日時 2021-10-15 22:37:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,216 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 92,488 KB
最終ジャッジ日時 2024-09-17 17:46:23
合計ジャッジ時間 19,755 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,X = map(int,input().split())
d = {x:[] for x in range(1,M+1)}


for i in range(N):
    A,B = map(int,input().split())
    d[B].append(A)

l = []
for k,v in d.items():
    tmp = sorted(v)
    if tmp:tmp[-1]+=X
    l+=tmp

l.sort(reverse=True)
com = [0]
for i in range(len(l)):
    com.append(com[i]+l[i])

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

ans = 0
for i in C:
    ans+=com[i]
print(ans)
0