← 返回 nvidia 的题目列表Minimum Sum After K Operations
类型:online_judge
Given an integer array a of length n and an integer k, perform exactly k operations to minimize the final sum.
Each operation:
Pick an index i and replace a[i] with ceil(a[i] / 2).
Output the minimum possible sum after k operations.
Input (stdin):
First line: n k
Second line: n integers
Output (stdout):
One line: the minimum achievable sum
Constraints:
1 <= n <= 2e5, 0 <= k <= 2e5, 1 <= a[i] <= 1e9.
Example
Input
3 3
10 20 7
Output
17