Codeforces Round 882 Div. 2: Solutions for Problems A through E
Problem A: The Man who became a God For a sequence (a) of length (n), define the cost of a segment ([l, r]) as (f(l, r) = \sum_{i=l}^{r-1} |a_i - a_{i+1}|). We need to partition the entire sequence into (k) contiguous segments to maximize the sum of segment costs. The total cost of the whole sequenc...