G – 1007

G – 1007 Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit   Status

Description

A university in Samara has held a qualification contest in figure programming, but the jury can’t come to terms how many teams should take part in the next stage of the contest. In figure programming a judge system doesn’t evaluate the scores precisely and just set an interval which the score can belong to. Jury is able to evaluate any participant with any score from this interval. There are n teams that took part in the contest, and the i-th of them has the score in the interval from li to ri, inclusively. Jury wants the number of qualified teams to be as large as possible, but they have to get the maximal score among all teams. What is the maximal number of teams that can take part in the next stage of the contest under such circumstances/p>

Input

The first line contains a single integer n (1?≤?n?≤?2·105) — the number of teams in the contest.

Each of the next n lines contains two space-separated integers: li and ri (?-?109?≤?li?≤?ri?≤??+?109) — the lower and upper bounds of the score for the i-th team.

Output

Output a single integer — the maximal number of teams that can get the maximal score.

Sample Input

Input Output

 

解题思路:

令标志变量存放最大左值,统计右值大于标志变量的个数

代码:

此题我做了很多次都没能过,就是思路不正确(太费空间),我想的是把每对区域里面的数进行统计,最后输出出现次数最多的数
错误代码:

 

来源:菜圾

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2017年3月2日
下一篇 2017年3月2日

相关推荐