結果
| 問題 |
No.1430 Coup de Coupon
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 20:54:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 968 bytes |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 82,152 KB |
| 実行使用メモリ | 849,224 KB |
| 最終ジャッジ日時 | 2025-04-15 20:57:47 |
| 合計ジャッジ時間 | 4,242 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)]
discount_list = []
for j in range(c):
t_j, x_j = coupons[j]
for i in range(n):
pi = prices[i]
if t_j == 1:
price = max(pi - x_j, 0)
else:
price = (pi * (100 - x_j)) // 100
discount = pi - price
if discount > 0:
discount_list.append((-discount, j, i)) # Store negative for ascending sort
# Sort the discount list to process largest discounts first
discount_list.sort()
used_coupons = [False] * c
used_products = [False] * n
total_discount = 0
for d_tuple in discount_list:
current_d = -d_tuple[0]
j = d_tuple[1]
i = d_tuple[2]
if not used_coupons[j] and not used_products[i]:
used_coupons[j] = True
used_products[i] = True
total_discount += current_d
sum_p = sum(prices)
print(sum_p - total_discount)
lam6er