atcoder#ABC218H. [ABC218H] Red and Blue Lamps
[ABC218H] Red and Blue Lamps
Score : points
Problem Statement
There are lamps numbered through arranged in a row. You are going to light of them in red and in blue.
For each , a reward of is given if Lamp and Lamp light up in different colors.
Find the maximum total reward that can be obtained by efficiently deciding the colors of the lamps.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
6 2
3 1 4 1 5
11
Lighting up Lamps in red and Lamps in blue yields a total reward of .
You cannot get any more, so the answer is .
7 6
2 7 1 8 2 8
10
Lighting up Lamps in red and Lamp in blue yields a total reward of .
11 7
12345 678 90123 45678901 234567 89012 3456 78901 23456 7890
46207983