## Subsequence solution codeforces

Subsequence solution codeforces Alice has an integer sequence aa of length nn and all elements are different. She will choose a subsequence of aa of length mm, and defines the value of a subsequence ab1,ab2,…,abmab1,ab2,…,abm as ∑i=1m(m⋅abi)−∑i=1m∑j=1mf(min(bi,bj),max(bi,bj)),∑i=1m(m⋅abi)−∑i=1m∑j=1mf(min(bi,bj),max(bi,bj)), where f(i,j)f(i,j) denotes min(ai,ai+1,…,aj)min(ai,ai+1,…,aj). Subsequence solution codeforces Alice wants you to help her to maximize the Continue reading Subsequence solution codeforces