結果
| 問題 |
No.1430 Coup de Coupon
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:21:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 82,108 KB |
| 実行使用メモリ | 849,060 KB |
| 最終ジャッジ日時 | 2025-03-31 17:22:50 |
| 合計ジャッジ時間 | 4,214 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 MLE * 1 -- * 20 |
ソースコード
n, c = map(int, input().split())
prices = [int(input()) for _ in range(n)]
coupons = [tuple(map(int, input().split())) for _ in range(c)]
savings_list = []
for i in range(n):
pi = prices[i]
for j in range(c):
tj, xj = coupons[j]
if tj == 1:
s = min(xj, pi)
else:
s = (pi * xj) // 100
if s > 0:
savings_list.append((-s, i, j)) # Negative for descending sort
savings_list.sort()
used_products = [False] * n
used_coupons = [False] * c
total_saving = 0
for s_neg, i, j in savings_list:
s = -s_neg
if not used_products[i] and not used_coupons[j]:
total_saving += s
used_products[i] = True
used_coupons[j] = True
original_sum = sum(prices)
print(original_sum - total_saving)
lam6er