| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 6 초 (추가 시간 없음) | 1024 MB | 2 | 2 | 2 | 100.000% |
Given an array of integers $A_i$ of length $N,ドル 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 $K$ 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: $N$ --- the number of elements in the array (1ドル \le N \le 100,000円$), $K$ --- the maximum possible number of swaps (0ドル \le K \le 10$). The second line lists the elements of the array $A_i,ドル one by one. All $A_i$ are integers, no larger than 10ドル^9$ by absolute value. It is guaranteed that there is at least one positive number among $A_i$.
The first line of the output file must contain two integers: $S$ --- the resulting sum of elements in the interval and $M$ --- the number of swaps performed (0ドル \le M \le K$).
The following $M$ lines must describe all swaps in order of their execution. For every $j$-th swap print two integers $u_j$ and $v_j,ドル denoting two positions in the array, whose values are to be swapped (1ドル \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: $L$ being the index of the leftmost position in the array belonging to the interval, and $R$ being the index of the rightmost position belonging to the interval (1ドル \le L \le R \le N$).
3 2 1 2 3
6 0 1 3
3 3 1 -2 3
4 2 1 2 2 3 2 3
3 0 1 -2 3
3 0 3 3