Account
GitHubFeedback
Drafts and results saved on this device
Submit on CSES.fi
CSES Problemset/Sorting and Searching

Factory Machines

#1620
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

Time limit:1.00 s
Memory limit:512 MB
Unsolved
Download Tests (.zip)

A factory has nn machines which can be used to make products. Your goal is to make a total of tt 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 tt products?

Input

The first input line has two integers nn and tt: the number of machines and products.

The next line has nn integers k1,k2,…,knk_1,k_2,\dots,k_n: the time needed to make a product using each machine.

Output

Print one integer: the minimum time needed to make tt products.

Constraints
  • 1≤n≤2⋅1051 \le n \le 2 \cdot 10^5
  • 1≤t≤1091 \le t \le 10^9
  • 1≤ki≤1091 \le k_i \le 10^9
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 chars
Test Bench
Download .zip
Input (stdin)
3 7
3 2 5
Expected Output
8