1534:统计牛奶桶

文件提交:无需freopen 内存限制:128 MB 时间限制:1.000 S
评测方式:普通裁判 命题人:
提交:12 解决:2

题目描述

Farmer John 正在考虑改变他给奶牛挤奶的时候分配牛奶桶的方式。他认为这最终能使得他使用数量更少的桶,然而他不清楚具体是多少。请帮助他!

Farmer John 有 lns="http://www.w3.org/1998/Math/MathML">N 头奶牛(lns="http://www.w3.org/1998/Math/MathML">1\le N\le 100),方便起见编号为 lns="http://www.w3.org/1998/Math/MathML">1\dots N。 第 lns="http://www.w3.org/1998/Math/MathML">i 头奶牛需要从时间 lns="http://www.w3.org/1998/Math/MathML">s_i 到时间 lns="http://www.w3.org/1998/Math/MathML">t_i 之间挤奶,并且挤奶过程中需要用到 lns="http://www.w3.org/1998/Math/MathML">b_i 个桶。于是多头奶牛可能在同一时刻都在挤奶;如果这样,他们不能使用相同的桶。也就是说,一个在第 lns="http://www.w3.org/1998/Math/MathML">i 头奶牛挤奶时用的桶不可以被任何在时间 lns="http://www.w3.org/1998/Math/MathML">s_i 到时间 lns="http://www.w3.org/1998/Math/MathML">t_i 之间挤奶的其他奶牛使用。当然,这个桶在这段时间之外可以被其他奶牛所使用。

FJ 有一个储藏室,里面有依次编号为 lns="http://www.w3.org/1998/Math/MathML">1lns="http://www.w3.org/1998/Math/MathML">2lns="http://www.w3.org/1998/Math/MathML">3、……的桶。在他的挤奶策略中,当某一头奶牛(比如说,奶牛 lns="http://www.w3.org/1998/Math/MathML">i)开始挤奶(在时间 lns="http://www.w3.org/1998/Math/MathML">s_i),FJ 就跑到储藏室取出编号最小的 lns="http://www.w3.org/1998/Math/MathML">b_i 个桶分配给第i头奶牛用来挤奶。

请求出 FJ 需要在储藏室中存放多少个桶才能使得他能够顺利地给所有奶牛挤奶。


输入

输入的第一行包含 lns="http://www.w3.org/1998/Math/MathML">N。以下 lns="http://www.w3.org/1998/Math/MathML">N 行,每行描述了一头奶牛,包含三个空格分隔的数 lns="http://www.w3.org/1998/Math/MathML">s_ilns="http://www.w3.org/1998/Math/MathML">t_i,和 lns="http://www.w3.org/1998/Math/MathML">b_i。 其中 lns="http://www.w3.org/1998/Math/MathML">s_i 和 lns="http://www.w3.org/1998/Math/MathML">t_i 均为 lns="http://www.w3.org/1998/Math/MathML">1\dots 1000 之间的整数,lns="http://www.w3.org/1998/Math/MathML">b_i 为 lns="http://www.w3.org/1998/Math/MathML">1\dots 10 之间的整数。

输出

输出一个整数,为 FJ 需要的桶的数量。

样例输入-1 复制

3
4 10 1
8 13 3
2 6 2

样例输出-1 复制

4