#K85632. Minimum Days to Grow All Plants
Minimum Days to Grow All Plants
Minimum Days to Grow All Plants
You are given n plants with their respective growth durations. Each day, you have the ability to reduce the remaining growth time of one plant by 1 by applying fertilizer. In order for all plants to be fully grown, you must wait until the plant with the maximum growth duration has been completed.
Mathematically, if the growth durations are given by \(d_1, d_2, \ldots, d_n\), then the minimum number of days required to grow all plants is: \[ \max\{d_1,d_2,\ldots,d_n\} \]
Your task is to compute this value based on the input provided.
inputFormat
The input is given via stdin and consists of two lines:
- The first line contains a single integer \(n\) (1 \(\leq n \leq 10^5\)) representing the number of plants.
- The second line contains \(n\) space-separated integers \(d_1, d_2, \ldots, d_n\) (each \(d_i\) is a positive integer) representing the growth durations of the plants.
outputFormat
Output a single integer to stdout which is the minimum number of days required to fully grow all the plants.
## sample3
3 1 2
3
</p>