#K80932. Maximizing the Minimum Element After k Operations
Maximizing the Minimum Element After k Operations
Maximizing the Minimum Element After k Operations
You are given an array A consisting of n integers, and a positive integer k representing the number of operations allowed. In each operation, you can choose any element of the array and replace it with any value. Your task is to maximize the minimum element in the array after exactly k operations.
The key observation is that you can always achieve at least the maximum element present in the initial array. In other words, the answer is equivalent to:
$$\max_{1 \leq i \leq n} A_i$$
Determine this maximum possible value of the minimum element after performing exactly k operations.
inputFormat
The first line contains two integers n and k separated by a space.
The second line contains n integers, representing the array A.
outputFormat
Output a single integer, which is the maximum possible value of the minimum element in the array after performing exactly k operations.
## sample4 2
1 5 3 2
5