Indegested Posters

In Nankai University, the poster board in front of Third Student Dining Hall is the most popular one among students. There are so many posters expected to be post there that the Students' Union have to arrange them to satisfy as many applicants as possible. Then Students' Union finds you are the one who can solve this problem by your programming genius. To help you to finish this job, Students' Union sets some rules as followed.

1.         All posters should have the same height with the board.

2.         No posters can overlay other posters. But their edges can be covered because no contents are on edges.

Every applicant wants his poster to be post as left as possible and assigns a line that his poster should be on the left side of this line. Or he will not admit Students' Union's arrangement and cancel his application.

Your task is to calculate how many posters can be post as most. The location of the left edge of board is assigned to be 0.

 

Input     (Please use standard input, and don’t read or write files.)

The first line contains an integer N, the number of posters (0< N <= 800000). It is followed by N lines. Each line contains two integers: W, the width of the poster (0< W <=1000), and R, its rightmost position (0< R <2 * 106).

Output   (Please use standard output, and don’t read or write files.)

The number of posters you can put on the board at most.

 

Sample Input

Sample Output

6

6 8

4 9

7 15

8 20

3 21

5 22

 

4

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值