結果

問題 No.1430 Coup de Coupon
ユーザー rlangevinrlangevin
提出日時 2023-04-18 12:24:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 712 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,952 KB
最終ジャッジ日時 2024-04-21 12:21:28
合計ジャッジ時間 8,677 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
51,712 KB
testcase_01 AC 46 ms
51,712 KB
testcase_02 AC 47 ms
51,840 KB
testcase_03 AC 60 ms
60,928 KB
testcase_04 AC 65 ms
63,744 KB
testcase_05 WA -
testcase_06 AC 480 ms
77,184 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline

N, C = map(int, readline().split())
P = [0] * N
for i in range(N):
    P[i] = int(readline())

X1, X2 = [], []
for i in range(C):
    T, X = map(int, readline().split())
    if T == 1:
        X1.append(X)
    else:
        X2.append(X)

C1, C2 = len(X1), len(X2)
X1.sort(reverse=True)
X2.sort(reverse=True)
inf = 10 ** 18
pre = [-inf] * (C + 1)
pre[0] = 0
for i in range(min(N, C)):
    dp = [-inf] * (C + 1)
    for j in range(C1):
        dp[j + 1] = max(dp[j + 1], pre[j] + min(P[i], X1[j]))
        j2 = i - j
        if j2 >= C2 or j2 < 0:
            continue
        dp[j] = max(dp[j], pre[j] + P[i]//100 * X2[j2])
    dp, pre = pre, dp

print(sum(P) - max(pre))
0