CF1070K.Video Posts
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Polycarp took n videos, the duration of the i -th video is ai seconds. The videos are listed in the chronological order, i.e. the 1 -st video is the earliest, the 2 -nd video is the next, ..., the n -th video is the last.
Now Polycarp wants to publish exactly k ( 1≤k≤n ) posts in Instabram. Each video should be a part of a single post. The posts should preserve the chronological order, it means that the first post should contain one or more of the earliest videos, the second post should contain a block (one or more videos) going next and so on. In other words, if the number of videos in the j -th post is sj then:
- s1+s2+⋯+sk=n ( si>0 ),
- the first post contains the videos: 1,2,…,s1 ;
- the second post contains the videos: s1+1,s1+2,…,s1+s2 ;
- the third post contains the videos: s1+s2+1,s1+s2+2,…,s1+s2+s3 ;
- ...
- the k -th post contains videos: n−sk+1,n−sk+2,…,n .
Polycarp is a perfectionist, he wants the total duration of videos in each post to be the same.
Help Polycarp to find such positive integer values s1,s2,…,sk that satisfy all the conditions above.
输入格式
The first line contains two integers n and k ( 1≤k≤n≤105 ). The next line contains n positive integer numbers a1,a2,…,an ( 1≤ai≤104 ), where ai is the duration of the i -th video.
输出格式
If solution exists, print "Yes" in the first line. Print k positive integers s1,s2,…,sk ( s1+s2+⋯+sk=n ) in the second line. The total duration of videos in each post should be the same. It can be easily proven that the answer is unique (if it exists).
If there is no solution, print a single line "No".
输入输出样例
输入#1
6 3 3 3 1 4 1 6
输出#1
Yes 2 3 1
输入#2
3 3 1 1 1
输出#2
Yes 1 1 1
输入#3
3 3 1 1 2
输出#3
No
输入#4
3 1 1 10 100
输出#4
Yes 3