CF1157D.N Problems During K Days
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Polycarp has to solve exactly n problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in k days. It means that Polycarp has exactly k days for training!
Polycarp doesn't want to procrastinate, so he wants to solve at least one problem during each of k days. He also doesn't want to overwork, so if he solves x problems during some day, he should solve no more than 2x problems during the next day. And, at last, he wants to improve his skill, so if he solves x problems during some day, he should solve at least x+1 problem during the next day.
More formally: let [a1,a2,…,ak] be the array of numbers of problems solved by Polycarp. The i -th element of this array is the number of problems Polycarp solves during the i -th day of his training. Then the following conditions must be satisfied:
- sum of all ai for i from 1 to k should be n ;
- ai should be greater than zero for each i from 1 to k ;
- the condition ai<ai+1≤2ai should be satisfied for each i from 1 to k−1 .
Your problem is to find any array a of length k satisfying the conditions above or say that it is impossible to do it.
输入格式
The first line of the input contains two integers n and k ( 1≤n≤109,1≤k≤105 ) — the number of problems Polycarp wants to solve and the number of days Polycarp wants to train.
输出格式
If it is impossible to find any array a of length k satisfying Polycarp's rules of training, print "NO" in the first line.
Otherwise print "YES" in the first line, then print k integers a1,a2,…,ak in the second line, where ai should be the number of problems Polycarp should solve during the i -th day. If there are multiple answers, you can print any.
输入输出样例
输入#1
26 6
输出#1
YES 1 2 4 5 6 8
输入#2
8 3
输出#2
NO
输入#3
1 1
输出#3
YES 1
输入#4
9 4
输出#4
NO