#C776. Maximum Array Value After Operations
Maximum Array Value After Operations
Maximum Array Value After Operations
You are given several test cases. In each test case, you are provided an integer N representing the size of an array, an integer K representing the number of operations (which will not affect the final answer), and N integers representing the array.
The goal is to calculate the maximum possible value that can be achieved at any index after performing exactly K operations. It turns out that if you sum up all the elements in the array, you will obtain the maximum possible value. Additionally, you must output the smallest (1-indexed) position where this maximum value occurs. Note that even though K is given, it does not affect the calculation in this specific problem.
Mathematical Explanation:
Let \( A = [a_1, a_2, \dots, a_N] \). Then, the maximum value is given by:
\[ \text{maxValue} = \sum_{i=1}^{N} a_i \]and the answer for the test case is the pair (maxValue, 1), since the first index is considered the smallest index for the maximum.
inputFormat
The first line of the input contains an integer T, representing the number of test cases.
For each test case, the first line contains two integers N and K separated by a space, where N is the number of elements in the array and K is the number of operations (which can be ignored for calculation).
The second line of each test case contains N space-separated integers representing the elements of the array.
outputFormat
For each test case, output a single line with two space-separated integers: the maximum possible value that can be obtained (which is the sum of the array) and the smallest index (1-indexed) where this maximum occurs.
## sample3
3 1
1 2 3
4 2
-1 -2 -3 -4
3 3
5 5 5
6 1
-10 1
15 1
</p>