#D8640. ABSum
ABSum
ABSum
problem
Given a sequence of length . You can swap the th and th () elements of a sequence up to times.
Find the maximum value of in the sequence created by the operation.
output
Find the maximum value of in the sequence created by the operation. Also, output a line feed at the end.
Example
Input
5 2 0 3 2 1 4
Output
12
inputFormat
outputFormat
output
Find the maximum value of in the sequence created by the operation. Also, output a line feed at the end.
Example
Input
5 2 0 3 2 1 4
Output
12
样例
5 2
0 3 2 1 4
12