302215: CF425A. Sereja and Swaps

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Sereja and Swaps

题意翻译

给一个长为 n 的序列,以及交换次数 k,每次可以在原先的序列 中任意交换两个数 交换后找一个最大子串和,输出其可能的最大值。 1 <= n <= 200; 1 <=k <=10

题目描述

As usual, Sereja has array $ a $ , its elements are integers: $ a[1],a[2],...,a[n] $ . Let's introduce notation: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF425A/32568eeb8040eb1aa136af55c788f7e656cb44a9.png)A swap operation is the following sequence of actions: - choose two indexes $ i,j $ $ (i≠j) $ ; - perform assignments $ tmp=a[i],a[i]=a[j],a[j]=tmp $ . What maximum value of function $ m(a) $ can Sereja get if he is allowed to perform at most $ k $ swap operations?

输入输出格式

输入格式


The first line contains two integers $ n $ and $ k $ $ (1<=n<=200; 1<=k<=10) $ . The next line contains $ n $ integers $ a[1] $ , $ a[2] $ , $ ... $ , $ a[n] $ $ (-1000<=a[i]<=1000) $ .

输出格式


In a single line print the maximum value of $ m(a) $ that Sereja can get if he is allowed to perform at most $ k $ swap operations.

输入输出样例

输入样例 #1

10 2
10 -1 2 2 2 2 2 2 -1 10

输出样例 #1

32

输入样例 #2

5 10
-1 -1 -1 -1 -1

输出样例 #2

-1

Input

题意翻译

给一个长为 n 的序列,以及交换次数 k,每次可以在原先的序列 中任意交换两个数 交换后找一个最大子串和,输出其可能的最大值。 1 <= n <= 200; 1 <=k <=10

加入题单

上一题 下一题 算法标签: