1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 #include using namespace std; #define REP(i,a,b) for (int i = (a); i <= (b); ++i) #define REPD(i,a,b) for (int i = (a); i >= (b); --i) #define FORI(i,n) REP(i,1,n) #define FOR(i,n) REP(i,0,int(n)-1) #define mp make_pair #define pb push_back #define pii pair #define vi vector #define ll long long #define SZ(x) int((x).size()) #define DBG(v) cerr << #v << " = " << (v) << endl; #define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) #define fi first #define se second const int BB = 61; const int N = 202; const ll inf = 4e17; int n; ll m; ll sum[N][N], dp[BB][N][N], dp2[BB][N]; ll a[N]; int main() { scanf("%d%lld", &n, &m); FORI(i,n) scanf("%lld", &a[i]); for (int le = 1; le <= n; le++) { sum[le][le] = 0; for (int ri = le+1; ri <= n+1; ri++) { sum[le][ri] = sum[le][ri-1] + a[ri-1]; } } FORI(le,n) { for (int ri=le+2;ri<=n+1;ri++) dp[0][le][ri] = -inf; dp[0][le][le+1] = 0; } for (int bits = 1; bits < BB; bits++) { int BL = bits > 10 ? n+5 : (1<