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

建议使用的浏览器:

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

5711:Ingress

题目描述
Brickgao, who profited from your accurate calculating last year, made a great deal of money by moving bricks. Now he became ``gay shy fool'' again and recently he bought an iphone and was deeply addicted into a cellphone game called Ingress. Now he is faced with a problem so he turns to you for help again. We make some slight modifications based on the original rules, so please draw attention to the details below.

There are $N$ portals (indexed from 1 to $N$) around Brickgao's home, and he can get some substances called XM by hacking the portals. It's known that for each portal $i$, he can get $A_i$ XM during the first hack, and after each hack, the amount of XM he will get during the next hack will decrease by $B_i$. If the amount of XM he can get is less than or equal to zero, Brickgao can't get XM from that portal anymore. For the $i$-th portal, if $A_i = 10, B_i = 2$ and he hacks 3 times, he will get 10, 8, 6 XM during each hack.

There are $M$ bidirectional roads between some pairs of portals and between Brickgao's home and some portals. Now he is eager to start his Ingress journey from home and finally return home, but due to the extremely hot weather, Brickgao will feel sick when you hack more than $K$ times or the distance he covers is more than $L$. So how much XM he can get at most during this journey?

输入解释
The first line contains a single integer $T(T\leq 20)$, indicating the number of test cases.

The first line of each case are four integers $N(1\leq N \leq 16), M(0 \leq M \leq \frac{N(N+1)}{2}), K(1 \leq K \leq 50)$ and $L(2 \leq L \leq 2000)$.
The second line of each case contains $N$ non-negative integers where the $i$-th denotes $A_i(A_i \leq 500)$.
The third line of each case contains $N$ non-negative integers where the $i$-th denotes $B_i(B_i \leq 50)$.
Each of next $M$ line contains 3 non-negative integers $u, v ( 0\leq u,v\leq n)$ and $c (0\leq c\leq 1000)$ , denotes that there is a road with the length of $c$ between the $u$-th and the $v$-th portal. If $u$ or $v$ equals to 0, it means Brickgao's home.
输出解释
For each test case, output the case number first, then the amount of maximum XM Brickgao can get.
输入样例
2
1 1 3 2
5
3
0 1 1
3 6 3 5
10 7 5
2 3 1
0 1 3
0 2 1
0 3 1
1 2 2
2 3 3
1 3 4
输出样例
Case 1: 7
Case 2: 16
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-5711

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

共提交 0

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