結果
| 問題 |
No.1708 Quality of Contest
|
| コンテスト | |
| ユーザー |
330Xs
|
| 提出日時 | 2022-01-31 18:31:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 828 bytes |
| コンパイル時間 | 333 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 143,708 KB |
| 最終ジャッジ日時 | 2024-06-11 09:02:28 |
| 合計ジャッジ時間 | 7,348 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 TLE * 1 -- * 16 |
ソースコード
from collections import deque
n,m,x = map(int,input().split())
lis = []
for _ in range(n):
ab = list(map(int,input().split()))
lis.append(ab)
u = int(input())
t = list(map(int,input().split()))
t_max = max(t)
dp = [-10**18] * (t_max+1)
dp[0] = 0
already_ind = set()
subject = set()
for i in range(1,t_max+1):
for j in range(n):
if(j not in already_ind):
if(lis[j][1] not in subject):
if(dp[i] < dp[i-1] + lis[j][0] + x):
dp[i] = dp[i-1] + lis[j][0] + x
max_ind = j
else:
if(dp[i] < dp[i-1] + lis[j][0]):
dp[i] = dp[i-1] + lis[j][0]
max_ind = j
already_ind.add(max_ind)
subject.add(lis[max_ind][1])
ans = 0
for i in range(u):
ans += dp[t[i]]
print(ans)
330Xs