#Lutece0242. Game
Game
Migrated from Lutece 242 Game
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Consider the following two-player game played with a sequence of N positive integers laid onto a game board. Player starts the game. The players move alternately by selecting a number from either the left or the right end of the sequence. That number is then deleted from the board, and its value is added to the score of the player who selected it. A player wins if his sum is greater than his opponents.
Write a program that implements the optimal strategy. The optimal strategy yields maximum points when playing against the best possible
opponent. Your program must further implement an optimal strategy for player .
Input
In the first line is one integer
cases follow. For each case, the first line contains one integer , the size of the board. Then the second line give you integers (no more than ) that are the contents of the game board, from left to right.
Output
For each case print one line with two integer and means the maximum points player and player can get.
Samples
1
6
4 7 2 9 5 2
18 11
Resources
modified from IOI'96 by lcq