Food Problem

TimeLimit:2000MS  MemoryLimit:131072KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Few days before a game of orienteering, Bell came to a mathematician to solve a big problem. Bell is preparing the dessert for the game. There are several different types of desserts such as small cookies, little grasshoppers and tiny mantises. Every type of dessert may provide different amounts of energy, and they all take up different size of space.

Other than obtaining the desserts, Bell also needs to consider moving them to the game arena. Different trucks may carry different amounts of desserts in size and of course they have different costs. However, you may split a single dessert into several parts and put them on different trucks, then assemble the parts at the game arena. Note that a dessert does not provide any energy if some part of it is missing.

Bell wants to know how much would it cost at least to provide desserts of a total energy of $p$ (most of the desserts are not bought with money, so we assume obtaining the desserts costs no money, only the cost of transportation should be considered). Unfortunately the mathematician is having trouble with her stomach, so this problem is left to you.
Input
The first line of input contains a integer $T (T \leq 10)$ representing the number of test cases.

For each test case there are three integers $n, m, p$ on the first line $(1 \leq n \leq 200, 1 \leq m \leq 200, 0 \leq p \leq 50000)$, representing the number of different desserts, the number of different trucks and the least energy required respectively.

The $i-th$ of the $n$ following lines contains three integers $t_i, u_i, v_i (1 \leq t_i \leq 100, 1 \leq u_i \leq 100, 1 \leq v_i \leq 100)$ indicating that the $i-th$ dessert can provide $t_i$ energy, takes up space of size $u_i$ and that Bell can prepare at most $v_i$ of them.

On each of the next $m$ lines, there are also three integers $x_j , y_j , z_j (1 \leq x_j \leq 100, 1 \leq y_j \leq 100, 1 \leq z_j \leq 100)$ indicating that the $j-th$ truck can carry at most size of $x_j$ , hiring each one costs $y_j$ and that Bell can hire at most $z_j$ of them.
Output
For every test case output the minimum cost to provide the dessert of enough energy in the game arena if it is possible and its cost is no more than $50000$. Otherwise, output $TAT$ on the line instead.
SampleInput
4
1 1 7
14 2 1
1 2 2
1 1 10
10 10 1
5 7 2
5 3 34
1 4 1
9 4 2
5 3 3
1 3 3
5 3 2
3 4 5
6 7 5
5 3 8
1 1 1
1 2 1
1 1 1
SampleOutput
4
14
12
TAT
Submit
题目统计信息详细
总AC数2
通过人数2
尝试人数3
总提交量4
AC率50.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签
出处

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: