and are squabbling over something petty again, as per tradition, they decided to settle it with a game of Admin War.
Let's revisit the rules of the game. Both players are dealt
You have, once again, taken a peek at their respective cards. However, it seems that they've noticed you this time, and have thus shuffled their decks thoroughly. Unable to determine the outcome of the game, you've decided that you would instead entertain yourself by finding the best possible outcome for each player. Specifically, you would like to know the maximum number of points each player can get in the best case scenario.
Input Specification
The first line of input will have
The second line of input will have
The third line of input will have
Output Specification
Output two integers on separate lines, the maximum number of points that
and can get, respectively.Sample Input
5
1 3 5 7 9
2 4 6 8 10
Sample Output
4
5
Explanation for Sample Output
A possible optimal situation for
is:7 5 9 3 1
6 4 8 2 10
A possible optimal situation for
is:10 4 8 6 2
9 3 7 5 1
Comments