Amplitude Hackathon Winter '25 Problem 4 - Golden Glizzy Gauntlet

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 1G

Problem type

It's time for the Golden Glizzy Gauntlet!

This year, Eric has assigned the numParticipants participants to eat a total of numHotDogs hot dogs. Each person has their own pace at which they can eat one hot dog. Each person starts eating a hot dog at the same time and when someone finishes, they immediately start eating another hot dog. Fractional hot dogs do not count.

How long will it take them to eat the assigned number of hot dogs?

Constraints

1 \le numParticipants \le 10^6

1 \le numHotDogs \le 10^{12}

1 \le secondsToEatOneHotDog \le 10^6

Subtask 1 [1 point]

numParticipants \le 50

numHotDogs \le 50

secondsToEatOneHotDog \le 50

Subtask 2 [1 point]

No additional constraints.

Input Specification

The first line contains two integers, numParticipants and numHotDogs.

The next line contains numParticipants integers, each one being the number of seconds to eat one hot dog for one of the numParticipants participants.

Output Specification

Output a single integer, the amount of time needed for the participants to eat numHotDogs hot dogs in seconds.

Sample Input 1

2 3
6 7

Sample Output 1

12

Sample Explanation 1

In 12 seconds, the first person eats two hot dogs and the second person eats one hot dog.


Comments

There are no comments at the moment.