結果

問題 No.1708 Quality of Contest
ユーザー tassei903tassei903
提出日時 2021-10-15 21:46:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 433 ms / 2,000 ms
コード長 805 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 81,748 KB
実行使用メモリ 161,720 KB
最終ジャッジ日時 2023-10-17 20:12:19
合計ジャッジ時間 8,519 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,480 KB
testcase_01 AC 37 ms
53,480 KB
testcase_02 AC 38 ms
53,480 KB
testcase_03 AC 78 ms
76,356 KB
testcase_04 AC 77 ms
76,304 KB
testcase_05 AC 77 ms
76,292 KB
testcase_06 AC 72 ms
74,756 KB
testcase_07 AC 79 ms
76,432 KB
testcase_08 AC 38 ms
53,480 KB
testcase_09 AC 389 ms
161,720 KB
testcase_10 AC 264 ms
147,464 KB
testcase_11 AC 360 ms
125,600 KB
testcase_12 AC 391 ms
132,052 KB
testcase_13 AC 327 ms
141,140 KB
testcase_14 AC 407 ms
128,776 KB
testcase_15 AC 428 ms
156,092 KB
testcase_16 AC 426 ms
152,220 KB
testcase_17 AC 389 ms
147,552 KB
testcase_18 AC 382 ms
147,668 KB
testcase_19 AC 413 ms
140,976 KB
testcase_20 AC 378 ms
131,128 KB
testcase_21 AC 403 ms
138,724 KB
testcase_22 AC 420 ms
129,368 KB
testcase_23 AC 433 ms
141,160 KB
testcase_24 AC 263 ms
143,452 KB
testcase_25 AC 258 ms
143,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

n,m,x = na()
g = [[] for i in range(m)]
for i in range(n):
    a,b = na()
    b-=1
    g[b].append(a)
p = []
for b in range(m):
    g[b] = sorted(g[b])[::-1]
    if len(g[b])>=1:
        p.append(g[b][0]+x)
        for j in range(1,len(g[b])):
            p.append(g[b][j])
p = sorted(p)[::-1]
s = [0]
for i in range(n):
    s.append(p[i]+s[-1])

ans = 0
k = ni()
C = na()
for i in range(k):
    ans += s[C[i]]
print(ans)
0