#BS0000279. Thổi bóng cho ngày hội thiếu nhi (Children Holiday)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Thổi bóng cho ngày hội thiếu nhi (Children Holiday)
Children Holiday
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
The organizers need exactly inflated balloons. There are helpers working concurrently. Helper i takes minutes per balloon and must rest for minutes after every batch of balloons before continuing. A rest after the last assigned balloon does not count. Find the shortest completion time and any optimal assignment of balloons to helpers.
Input
First line: . Each of the next n lines contains .
Output
Print the minimum time on the first line. On the second line, print nonnegative integers summing to m; helper i must finish balloons within T minutes. Any optimal assignment is accepted.
Subtasks
- Subtask 1 (20 points): ; ; ; ().
- Subtask 2 (30 points): ; ; ; (); mọi bộ bằng nhau.
- Subtask 3 (50 points): ; ; ; ().
Examples
Input 1
4 2
1 2 3
2 3 1
Output 1
4
2 2
Explanation
In four minutes, the first helper makes two balloons and rests, while the second makes two balloons. In three minutes, the combined capacity is only 2+1=3.