結果
問題 |
No.1430 Coup de Coupon
|
ユーザー |
![]() |
提出日時 | 2025-04-15 21:13:13 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 703 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 82,100 KB |
実行使用メモリ | 849,108 KB |
最終ジャッジ日時 | 2025-04-15 21:19:17 |
合計ジャッジ時間 | 4,051 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)] edges = [] for i in range(n): p = prices[i] for j in range(c): t, x = coupons[j] if t == 1: s = min(x, p) else: s = (p * x) // 100 if s > 0: edges.append((-s, i, j)) # Store negative for ascending sort edges.sort() used_p = [False] * n used_c = [False] * c total_savings = 0 for e in edges: s = -e[0] i = e[1] j = e[2] if not used_p[i] and not used_c[j]: total_savings += s used_p[i] = True used_c[j] = True print(sum(prices) - total_savings)