#K61557. Minimum Valid Climbing Time
Minimum Valid Climbing Time
Minimum Valid Climbing Time
You are given a dataset that records the times users took to reach a certain level of stairs. Your task is to determine the minimum valid time required to reach that level. A valid time is defined as a time that is strictly greater than 0.
Formally, let \(T = \{ t_1, t_2, \dots, t_n \}\) be the list of recorded times. You need to compute the value
\(\min\{t \in T \mid t > 0\}\)
if there exists at least one valid time; otherwise, output -1
.
The integer k
is provided as part of the input for consistency with the problem statement but will not affect the result.
inputFormat
The input is read from stdin
and contains two lines:
- The first line contains two integers
n
andk
, wheren
is the number of records andk
is the target level (unused in computation). - The second line contains
n
space-separated integers representing the recorded times.
outputFormat
Output a single integer representing the minimum valid time (a positive integer) from the dataset. If there is no valid time, output -1
.
The output should be printed to stdout
.
5 3
7 -3 10 5 5
5
</p>