結果

問題 No.1708 Quality of Contest
ユーザー brthyyjpbrthyyjp
提出日時 2021-10-16 02:43:08
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 356 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 81,736 KB
実行使用メモリ 157,744 KB
最終ジャッジ日時 2023-10-17 22:01:45
合計ジャッジ時間 8,046 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,604 KB
testcase_01 AC 40 ms
55,604 KB
testcase_02 AC 41 ms
55,604 KB
testcase_03 AC 85 ms
77,068 KB
testcase_04 AC 85 ms
77,048 KB
testcase_05 AC 86 ms
77,144 KB
testcase_06 AC 84 ms
77,012 KB
testcase_07 AC 89 ms
77,116 KB
testcase_08 AC 41 ms
55,608 KB
testcase_09 AC 316 ms
157,744 KB
testcase_10 AC 296 ms
146,468 KB
testcase_11 AC 327 ms
145,368 KB
testcase_12 AC 335 ms
150,648 KB
testcase_13 AC 320 ms
142,728 KB
testcase_14 AC 338 ms
152,756 KB
testcase_15 AC 351 ms
156,448 KB
testcase_16 AC 347 ms
156,188 KB
testcase_17 AC 338 ms
151,364 KB
testcase_18 AC 337 ms
153,200 KB
testcase_19 AC 339 ms
153,592 KB
testcase_20 AC 336 ms
151,104 KB
testcase_21 AC 346 ms
156,192 KB
testcase_22 AC 339 ms
153,024 KB
testcase_23 AC 356 ms
156,020 KB
testcase_24 AC 297 ms
131,904 KB
testcase_25 AC 293 ms
131,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,x = map(int, input().split())
AB = []
for i in range(n):
    a, b = map(int, input().split())
    b -= 1
    AB.append((a, b))
k = int(input())
C = list(map(int, input().split()))
from itertools import accumulate
imos = [0]*(n+1)
for c in C:
    imos[0] += 1
    imos[c] -= 1
imos = list(accumulate(imos))
from collections import defaultdict
d = defaultdict(lambda: [])
for a, b in AB:
    d[b].append(a)
L = []
for k, l in d.items():
    l.sort(reverse=True)
    l[0] += x
    L += l
L.sort(reverse=True)
ans = 0
for i in range(n):
    ans += imos[i]*L[i]
print(ans)
0