PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000093. Phiếu giảm giá mạnh (Powerful Discount Tickets)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Phiếu giảm giá mạnh (Powerful Discount Tickets)
Powerful Discount Tickets
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
There are items with initial prices and discount tickets. Each ticket halves the current price of a chosen item, rounding down. You may use several tickets on the same item. Find the minimum total amount needed to buy all items.
Input
The first line contains integers ; the second contains prices .
Output
Print one integer: the minimum total cost.
Subtasks
- Subtask 1 (20 points): ; ; for every .
- Subtask 2 (30 points): ; ; for every .
- Subtask 3 (50 points): ; ; for every .
Examples
Input
3 3
2 13 8
Output
9
Explanation
The original prices are . Two coupons change to , and one changes to . The first item stays , giving .