結果
| 問題 |
No.1430 Coup de Coupon
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-20 09:07:11 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 778 bytes |
| コンパイル時間 | 308 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 215,332 KB |
| 最終ジャッジ日時 | 2024-10-10 07:10:57 |
| 合計ジャッジ時間 | 4,476 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 1 -- * 20 |
ソースコード
N, C = map(int, input().split())
P = []
for _ in range(N):
P.append(int(input()))
P.sort(reverse=True)
TY = []
TP = []
for _ in range(C):
T, X = map(int, input().split())
if T == 1:
TY.append(X)
else:
TP.append(X)
TY.sort(reverse=True)
TP.sort(reverse=True)
L = len(TY)
DP = [[float('inf')] * (L+1) for _ in range(N+1)]
DP[0][0] = 0
for i in range(N):
for j in range(L+1):
if i-j < 0:
cost = 0
elif i-j < len(TP):
cost = P[i] * (100 - TP[i-j]) // 100
else:
cost = P[i]
DP[i+1][j] = min(DP[i+1][j], DP[i][j] + cost)
if j < L:
cost = P[i] - min(P[i], TY[j])
DP[i+1][j+1] = min(DP[i+1][j+1], DP[i][j] + cost)
print(min(DP[N]))