Problem 2918 --3.3.5 A Game

2918: 3.3.5 A Game

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $2$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 usaco

Consider the following two-player game played with a sequence of N positive integers (2 <= N <= 100) laid onto a game board. Player 1 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 2.


Line 1:  N, the size of the board 
Line 2-etc:  N integers in the range (1..200) that are the contents of the game board, from left to right
Two space-separated integers on a line: the score of Player 1 followed by the score of Player 2.

6
4 7 2 9
5 2
18 11

推荐代码 查看2918 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC 淡意的温柔 596600 2020-06-12 17:11:42
第一挑战 淡意的温柔 596588 2020-06-12 17:10:22

赛题来源/所属竞赛 usaco training usaco Training

竞赛编号 竞赛名称 竞赛时间 访问比赛