Setting a Time Limit
Time limit2sMemory limit512 MB
Given n runtimes in milliseconds and a factor s, output the smallest whole number of seconds that is at least s times the largest runtime.
- Level
Easy2 of 10
- Topics
- Math, Implementation, Array
- Solved
- No attempts yet
Problem
Your Chief Judge needs help! He needs to set the time limit for a problem in the problem set. He has solutions written by his judges. He knows how long each runs in the contest environment, in milliseconds. He wants to set the time limit to be at least times the slowest solution from his judges, but as small as possible, and he wants it to be an integral number of seconds. Can you help him?
Input
Each input consists of a single test case. Your program may be run multiple times on different inputs.
Each test case begins with a line containing two space-separated integers () and (), where is the number of solutions from judges and is the multiplying factor.
The next line contains space-separated integers (), which are the number of milliseconds it takes for some judge's solution to run in the contest environment.
Output
Output a single integer, the time limit to set for this problem. It is in seconds, and it is the smallest time that is at least times the slowest judge's solution.