当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2994:Ant on the graph

题目描述
You are given a directed graph with n vertices, labeled 1 to n. The edges of the graph contain values, and each time you traverse an edge, the value of that edge you traverse was added to your total score. If the same edge is traversed multiple times, its value was added every time. Values can be any number between -499 and 499, inclusive. There are no edges that connect a vertex to itself.
There's an ant at vertex 1 and it wants to get to vertex n. It must do this in an integer number of seconds between Tmin and Tmax, inclusive. The ant must make exactly one step each second, where each step consists of moving from its current vertex V to an adjacent vertex W (W is adjacent to V if there's a directed edge from V to W in the graph). The ant's goal is to get the highest score possible.
输入解释
There are multiple test cases.
For each test case, the first line contains three integers, n, Tmin and Tmax (2<=n<=50, 1<=Tmin<=Tmax<=1000000000).
Following n lines, shows an n*n matrix. The element aij (-499<=aij<=499) which in the i-th row and j-th column indicates an edge from the vertex i to vertex j values aij. If the aij equals to -500, means such edge didn’t exist. The elements in the diagonal are always -500, which means aii=-500 all the time.
输出解释
For every test case, output one line, means the max score the ant can get. If it’s impossible to get to vertex n, output ‘IMPOSSIBLE’.
输入样例
2 3 6
-500 1
1 -500
输出样例
5
来自杭电HDUOJ的附加信息
Recommend chenrui

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2994

最后修改于 2020-10-25T22:59:00+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)