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

建议使用的浏览器:

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

6018:Game Arrangement

题目描述
Luras is fond of playing games. Once she gets free, she might try playing games such as dato and cf.

However, if you have read the past problems, you will know that luras is very busy even if she skips many classes.

As a result, she wants to arrange her time for playing more rounds of games during her free time.

It is known that luras has m types of games which she is willing to play, and for each game type, there is a time segment,

luras will only try playing one game type during its limited time segment (and ofc in the class-skipping time).

Besides, you are told of the needed time for each round of every game type.

Be attention, once luras started a game, she needs to finish it without any break during the limited time.

Now please help luras arrange her time in order to play more rounds of games.
输入解释
The first line is an integer T which indicates the case number.

and as for each case,

the first line are two integer n and m which indicate the number of time segment of skipping the class and the game types luras wants to try.

then there are n lines, for the i-th line, there are 2 integers L[i] and R[i], which mean that luras could skip the class for games at the R[i] - L[i] + 1 time point { L[i], L[i] + 1, ..., R[i] - 1, R[i] }.

then there are m lines, for the i-th line, there are 3 integers l[i], r[i] and d[i], which mean that only during the r[i] - l[i] + 1 time point { l[i], l[i] + 1, ..., r[i] - 1, r[i] }, could luras play the i-th type game.
once luras spends a d[i] continuous time segment during [ l[i], r[i] ], she could finish 1 round of the i-th game.

At last please note luras could only play at most 1 round game at a time point, she is a cut noob : ) .

It is guaranteed that——

1 <= T <= 1000

1 <= L[1] <= R[1] < L[2] <= R[2] < ... < L[n] <= R[n] <= 10^9

1 <= l[] <= r[] <= 10^9

1 <= d[] <= 10^9

for 99% cases,1 <= n, m <= 100

for 100% cases,1 <= n, m <= 10000
输出解释
As for each case, you need to output a single line.

there should be 1 integer in the line which represents the most rounds of games luras can play if she arrange in the best way.
输入样例
4
2 2
1 1
2 5
1 3 1
4 5 2

2 2
1 1
3 4
1 3 1
4 5 2

3 1
1 1
3 3
5 5
1 5 2

1 1
1 10
3 5 2
输出样例
4
2
0
1
来自杭电HDUOJ的附加信息
Recommend wange2014

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

题目来源 BestCoder Round #92

源链接: HDU-6018

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

共提交 0

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