Maximum sum with swaps

아직 제출이 없습니다시간 제한6초메모리 제한1024 MB

문제

Given an array of integers A_iA\_i of length NN, you are to find an interval within the array, which has maximum sum of the elements in it. However, before choosing the interval, you are allowed to perform no more than KK swaps. Each swap makes two elements of the array exchange places.

An interval within the array is an arbitrary set of its consecutive elements.

입력

The first line of the input file contains two integers: NN --- the number of elements in the array (1N100,0001 \le N \le 100\\,000), KK --- the maximum possible number of swaps (0K100 \le K \le 10). The second line lists the elements of the array A_iA\_i, one by one. All A_iA\_i are integers, no larger than 10910^9 by absolute value. It is guaranteed that there is at least one positive number among A_iA\_i.

출력

The first line of the output file must contain two integers: SS --- the resulting sum of elements in the interval and MM --- the number of swaps performed (0MK0 \le M \le K).

The following MM lines must describe all swaps in order of their execution. For every jj-th swap print two integers u_ju\_j and v_jv\_j, denoting two positions in the array, whose values are to be swapped (1u_jv_jN1 \le u\_j \neq v\_j \le N). The positions in the array are numbered consecutively starting from one.

The last line must contain the interval where the sum must be calculated, described as two integers: LL being the index of the leftmost position in the array belonging to the interval, and RR being the index of the rightmost position belonging to the interval (1LRN1 \le L \le R \le N).