Drinking

查看题解 查看答案
题目描述
Time Limit: 1000 ms
Memory Limit: 256 mb

Xiaoxia is also a wine lover. He likes drinking very much. But because of his health , he can only drink m bottles of wine at most every day. We also know that the more fragrant it is, the more it will hurt people. Xiaoxia has n bottles of wine. Each bottle has an initial degree of injury expressed by AI. The day after drinking AI, the degree of injury will be increased It will be (d * AI). Each bottle of wine can only be drunk once at most, not more. Xiaoxia just chose K bottles of wine and drank them in any order he wanted to drink. He can get the minimum damage. However, because Xiaoxia loves wine so much, he wants you to help him arrange every value between K (1 ~ n) and get the minimum damage.
 

输入输出格式
输入描述:
The first line contains two integers n and m(1≤m≤n≤ 200,000). The second row contains n integers a1,a2... The an (1 ≤ai ≤200000 ) or less.
输出描述:
You must output n integers x1,x2... , xn on the line, separated by Spaces, xi is the minimum total damage from eating I bottles of wine.
输入输出样例
输入样例#:
3 2
50314 12156 18453
输出样例#:
复制
12156 30609 93079
编辑器外观×
主题
字号 16px
背景
登录后免费刷此题

提交代码后在此处可查看状态