[链接] 我是链接,点我呀:) [题意] 题意 [题解] 枚举最大值和最小值在什么地方. 显然,只要包含最小值的区间,都让他减少. 因为就算那个区间包含最大值,也无所谓,因为不会让答案变小. 但是那些不包含最大值的区间却能让差值变大. 所以没有问题. [代码] #include <bits/stdc++.h> #define ll long long using namespace std; const int N = 300; int n,m; int a[N+10],segl[N+10],…
题 You are given array ai of length n. You may consecutively apply two operations to this array: remove some subsegment (continuous subsequence) of length m < n and pay for it m·a coins; change some elements of the array by at most 1, and pay b coins…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Amr has got a large array of size n. Amr doesn't like large arrays so he intends to make it smaller. Amr doesn't care about anything in the array…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he invented positive integer…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output One spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts. This time Lesha decided to split…