結果
| 問題 |
No.1708 Quality of Contest
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-10-16 02:43:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 325 ms / 2,000 ms |
| コード長 | 572 bytes |
| コンパイル時間 | 158 ms |
| コンパイル使用メモリ | 82,076 KB |
| 実行使用メモリ | 157,892 KB |
| 最終ジャッジ日時 | 2024-09-17 19:16:01 |
| 合計ジャッジ時間 | 7,295 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
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)
brthyyjp