結果

問題 No.1708 Quality of Contest
ユーザー 330Xs330Xs
提出日時 2022-01-31 18:31:43
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 828 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 134,544 KB
最終ジャッジ日時 2023-09-02 02:22:56
合計ジャッジ時間 8,078 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
71,932 KB
testcase_01 AC 88 ms
71,776 KB
testcase_02 AC 88 ms
71,824 KB
testcase_03 AC 553 ms
79,124 KB
testcase_04 AC 783 ms
79,104 KB
testcase_05 AC 618 ms
79,036 KB
testcase_06 AC 358 ms
78,796 KB
testcase_07 AC 399 ms
78,684 KB
testcase_08 AC 85 ms
71,812 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0