Problem H
Robbers are Often Robbed
Mario finds himself in a wealthy neighborhood. There are
Once Mario has completed his robbery, he will encounter
Bowser who will steal exactly half of his knapsacks. Bowser
will of course steal the sacks with the most stars. Knowing
this, Mario has two objectives. His first priority is to
maximize the amount of stars that he has at the end. After
maximizing this value
For example, in the first sample case, Mario can steal
However, in the second sample case, Mario will split the
Output two numbers representing the maximum stars Mario can rob and the minimum number of stars he must give Bowser.
Input
The first line contains two space-separated integers:
The next line will contain
Output
Output one line containing two numbers representing the maximum stars Mario can rob and the minimum number of stars he must give Bowser in that order.
Sample Input 1 | Sample Output 1 |
---|---|
10 4 3 12 4 6 1 10 8 9 18 0 |
19 20 |
Sample Input 2 | Sample Output 2 |
---|---|
3 4 9 30 11 |
20 20 |