A930.Greedy Pie Eaters--Platinum
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:128MB
题目描述
Farmer John has M cows, conveniently labeled 1…M, who enjoy the
occasional change of pace from eating grass. As a treat for the cows, Farmer
John has baked N pies (1≤N≤300), labeled 1…N. Cow i
enjoys pies with labels in the range [li,ri] (from li to ri
inclusive), and no two cows enjoy the exact same range of pies. Cow i also
has a weight, wi, which is an integer in the range 1…106.
Farmer John may choose a sequence of cows c1,c2,…,cK, after which
the selected cows will take turns eating in that order. Unfortunately, the
cows don't know how to share! When it is cow ci's turn to eat, she will
consume all of the pies that she enjoys --- that is, all remaining pies in the
interval [lci,rci]. Farmer John would like to avoid the awkward
situation occurring when it is a cows turn to eat but all of the pies she
enjoys have already been consumed. Therefore, he wants you to compute the
largest possible total weight (wc1+wc2+…+wcK) of a sequence
c1,c2,…,cK for which each cow in the sequence eats at least one
pie.
输入格式
- Test cases 2-5 satisfy N≤50 and M≤20.
- Test cases 6-9 satisfy N≤50.
输出格式
The first line contains two integers N and M (1≤M≤2N(N+1)).
The next M lines each describe a cow in terms of the integers wi,li,
and ri.
输入输出样例
输入#1
Print the maximum possible total weight of a valid sequence.
输出#1
2 2 100 1 2 100 1 1
说明/提示
200