Problem B
Bouquet
After visiting Keukenhof, one of the world’s largest flower gardens, Lieke became very fond of flowers, so she has decided to collect some tulips growing next to the road in order to build a beautiful bouquet. However, when collecting the flowers, she has to respect some rules due to the strict tulip protection laws in the Netherlands.
There are
Lieke wonders what the maximum number of tulips she can pick is if she picks her flowers optimally. Help her build a beautiful bouquet by finding the answer to her question!
Input
The first line of input contains a single integer
The following
Output
Output a single integer, the maximum number of tulips Lieke can pick while respecting the protection law.
Constraints and Scoring
-
. -
for .
Your solution will be tested on a set of test groups, each worth a number of points. Each test group contains a set of test cases. To get the points for a test group, you need to solve all test cases in the test group.
Group |
Score |
Limits |
1 |
8 |
|
2 |
16 |
|
3 |
28 |
|
4 |
18 |
|
5 |
30 |
No additional constraints |
Examples
Note that some of the samples are not valid input for all test groups.
In the first sample, if Lieke picks tulip
In the second sample, the maximum possible number of tulips
Lieke can pick is
In the third sample, the maximum number of
Sample Input 1 | Sample Output 1 |
---|---|
3 0 3 1 0 1 0 |
1 |
Sample Input 2 | Sample Output 2 |
---|---|
5 0 3 1 0 0 1 2 0 1 0 |
3 |
Sample Input 3 | Sample Output 3 |
---|---|
7 0 0 0 0 1 0 1 0 2 0 3 0 2 0 |
4 |
Sample Input 4 | Sample Output 4 |
---|---|
6 2 2 2 2 2 2 2 2 2 2 2 2 |
2 |
Sample Input 5 | Sample Output 5 |
---|---|
7 0 2 2 0 1 1 2 2 0 0 0 1 0 1 |
3 |