atcoder#ARC074B. [ABC062D] 3N Numbers
[ABC062D] 3N Numbers
Score : points
Problem Statement
Let be a positive integer.
There is a numerical sequence of length , . Snuke is constructing a new sequence of length , , by removing exactly elements from without changing the order of the remaining elements. Here, the score of is defined as follows: the sum of the elements in the first half of the sum of the elements in the second half of .
Find the maximum possible score of .
Constraints
- is an integer.
Partial Score
- In the test set worth points, .
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible score of .
2
3 1 4 1 5 9
1
When and are removed, will be , which has a score of .
1
1 2 3
-1
For example, when are removed, will be , which has a score of .
3
8 2 2 7 4 6 5 3 8
5
For example, when , and are removed, will be , which has a score of .