Codeforces Round 763 (Div. 2) |
---|
Finished |
There are $$$n$$$ heaps of stone. The $$$i$$$-th heap has $$$h_i$$$ stones. You want to change the number of stones in the heap by performing the following process once:
What is the maximum number of stones in the smallest heap after the process?
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^5$$$). Description of the test cases follows.
The first line of each test case contains a single integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$).
The second lines of each test case contains $$$n$$$ integers $$$h_1, h_2, h_3, \ldots, h_n$$$ ($$$1 \le h_i \le 10^9$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, print the maximum number of stones that the smallest heap can contain.
441 2 10 1004100 100 100 155 1 1 1 861 2 3 4 5 6
7 1 1 3
In the first test case, the initial heap sizes are $$$[1, 2, 10, 100]$$$. We can move the stones as follows.
In the second test case, the last heap is $$$1$$$, and we can not increase its size.
In the third test case, it is better not to move any stones.
In the last test case, the final achievable configuration of the heaps can be $$$[3, 5, 3, 4, 3, 3]$$$.
Name |
---|