CF1070K.Video Posts

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Polycarp took nn videos, the duration of the ii -th video is aia_i seconds. The videos are listed in the chronological order, i.e. the 11 -st video is the earliest, the 22 -nd video is the next, ..., the nn -th video is the last.

Now Polycarp wants to publish exactly kk ( 1kn1 \le k \le 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 jj -th post is sjs_j then:

  • s1+s2++sk=ns_1+s_2+\dots+s_k=n ( si>0s_i>0 ),
  • the first post contains the videos: 1,2,,s11, 2, \dots, s_1 ;
  • the second post contains the videos: s1+1,s1+2,,s1+s2s_1+1, s_1+2, \dots, s_1+s_2 ;
  • the third post contains the videos: s1+s2+1,s1+s2+2,,s1+s2+s3s_1+s_2+1, s_1+s_2+2, \dots, s_1+s_2+s_3 ;
  • ...
  • the kk -th post contains videos: nsk+1,nsk+2,,nn-s_k+1,n-s_k+2,\dots,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,,sks_1, s_2, \dots, s_k that satisfy all the conditions above.

输入格式

The first line contains two integers nn and kk ( 1kn1051 \le k \le n \le 10^5 ). The next line contains nn positive integer numbers a1,a2,,ana_1, a_2, \dots, a_n ( 1ai1041 \le a_i \le 10^4 ), where aia_i is the duration of the ii -th video.

输出格式

If solution exists, print "Yes" in the first line. Print kk positive integers s1,s2,,sks_1, s_2, \dots, s_k ( s1+s2++sk=ns_1+s_2+\dots+s_k=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 
首页