結果

問題 No.1708 Quality of Contest
ユーザー Eki1009Eki1009
提出日時 2021-10-15 21:41:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 417 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,752 KB
実行使用メモリ 134,088 KB
最終ジャッジ日時 2023-10-17 20:08:56
合計ジャッジ時間 8,493 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,504 KB
testcase_01 AC 37 ms
53,504 KB
testcase_02 AC 37 ms
53,504 KB
testcase_03 AC 81 ms
76,644 KB
testcase_04 AC 83 ms
76,620 KB
testcase_05 AC 81 ms
76,316 KB
testcase_06 AC 75 ms
74,408 KB
testcase_07 AC 75 ms
74,588 KB
testcase_08 AC 36 ms
53,504 KB
testcase_09 AC 370 ms
134,088 KB
testcase_10 AC 265 ms
123,420 KB
testcase_11 AC 374 ms
125,192 KB
testcase_12 AC 376 ms
118,336 KB
testcase_13 AC 342 ms
122,148 KB
testcase_14 AC 392 ms
119,780 KB
testcase_15 AC 412 ms
129,324 KB
testcase_16 AC 405 ms
128,092 KB
testcase_17 AC 387 ms
128,592 KB
testcase_18 AC 394 ms
129,176 KB
testcase_19 AC 397 ms
120,924 KB
testcase_20 AC 387 ms
128,292 KB
testcase_21 AC 398 ms
124,368 KB
testcase_22 AC 387 ms
119,084 KB
testcase_23 AC 417 ms
129,012 KB
testcase_24 AC 280 ms
129,944 KB
testcase_25 AC 276 ms
129,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,x = map(int,input().split())
L = [[] for _ in range(m+1)]
for _ in range(n):
    a,b = map(int,input().split())
    L[b].append(a)
Z = []
for l in L:
    if not l:
        continue
    l.sort()
    l[-1] += x
    for z in l:
        Z.append(z)
Z.sort(reverse=True)
D = [0]*(n+1)
for i,z in enumerate(Z):
    D[i+1] = D[i]+z
k = int(input())
C = tuple(map(int,input().split()))
ans = 0
for c in C:
    ans += D[c]
print(ans)
0