結果

問題 No.1708 Quality of Contest
ユーザー titiatitia
提出日時 2021-10-16 01:49:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 839 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 11,892 KB
実行使用メモリ 90,336 KB
最終ジャッジ日時 2023-10-17 22:00:52
合計ジャッジ時間 14,333 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,944 KB
testcase_01 AC 28 ms
9,944 KB
testcase_02 AC 28 ms
10,008 KB
testcase_03 AC 37 ms
11,200 KB
testcase_04 AC 40 ms
11,412 KB
testcase_05 AC 38 ms
11,160 KB
testcase_06 AC 36 ms
11,024 KB
testcase_07 AC 36 ms
10,996 KB
testcase_08 AC 28 ms
9,944 KB
testcase_09 AC 664 ms
90,336 KB
testcase_10 AC 567 ms
58,464 KB
testcase_11 AC 718 ms
69,396 KB
testcase_12 AC 740 ms
71,048 KB
testcase_13 AC 692 ms
65,416 KB
testcase_14 AC 748 ms
73,100 KB
testcase_15 AC 839 ms
78,392 KB
testcase_16 AC 818 ms
79,384 KB
testcase_17 AC 710 ms
69,560 KB
testcase_18 AC 725 ms
71,160 KB
testcase_19 AC 775 ms
75,700 KB
testcase_20 AC 707 ms
70,208 KB
testcase_21 AC 810 ms
77,256 KB
testcase_22 AC 770 ms
74,704 KB
testcase_23 AC 808 ms
79,368 KB
testcase_24 AC 602 ms
59,088 KB
testcase_25 AC 602 ms
59,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,M,p=map(int,input().split())
P=[tuple(map(int,input().split())) for i in range(N)]
K=int(input())
C=list(map(int,input().split()))

X=dict()

for a,b in P:
    if b in X:
        X[b].append(a)
    else:
        X[b]=[a]

XX=[]

for i in X:
    X[i].sort()
    X[i][-1]+=p
    XX+=X[i]

XX.sort(reverse=True)

S=[0]
for xx in XX:
    S.append(S[-1]+xx)

ANS=0

for c in C:
    ANS+=S[c]

print(ANS)
0