CSES Problemset/Sorting and Searching
Factory Machines
#1620Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopA factory has machines which can be used to make products. Your goal is to make a total of products.
For each machine, you know the number of seconds it needs to make a single product. The machines can work simultaneously, and you can freely decide their schedule.
What is the shortest time needed to make products?
Input
The first input line has two integers and : the number of machines and products.
The next line has integers : the time needed to make a product using each machine.
Output
Print one integer: the minimum time needed to make products.
Constraints
Sample Test Cases (1)
Example 1ID: sample-1
Input
3 7 3 2 5
Expected Output
8
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
3 7 3 2 5
Expected Output
8