#P2734. [IOI 1996 / USACO3.3] 游戏 A Game
[IOI 1996 / USACO3.3] 游戏 A Game
Description
Write a program that plays optimally to compute the final scores. An optimal strategy is one that, when facing the best possible opponent, gives the player the maximum total score possible in the current situation. Your program should always apply the optimal strategy for both players.
Input Format
The first line: a positive integer , indicating the number of positive integers in the sequence.
From the second line to the end: space-separated positive integers (each in ).
Output Format
A single line with two integers separated by a space: the final scores of the first player and the second player, in that order.
6
4 7 2 9 5 2
18 11
Hint
Problem translation sourced from NOCOW.
Translated by ChatGPT 5
京公网安备 11011102002149号