欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1070K.Video Posts
Video Posts
Polycarp took videos, the duration of the -th video is seconds. The videos are listed in the chronological order, i.e. the -st video is the earliest, the -nd video is the next, ..., the -th video is the last.
Now Polycarp wants to publish exactly () 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 -th post is then:
- (),
- the first post contains the videos: ;
- the second post contains the videos: ;
- the third post contains the videos: ;
- ...
- the -th post contains videos: .
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 that satisfy all the conditions above.
Input
The first line contains two integers and (). The next line contains positive integer numbers (), where is the duration of the -th video.
Output
If solution exists, print "Yes" in the first line. Print positive integers () 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".
Samples
6 3
3 3 1 4 1 6
Yes
2 3 1
3 3
1 1 1
Yes
1 1 1
3 3
1 1 2
No
3 1
1 10 100
Yes
3
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |