QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 32 MB Puntuación total: 100

#315. 温度

Estadísticas

Byteotian 气象研究所(BIM)每天都会测量气温。测量过程是自动完成的,结果会立即打印出来。不幸的是,打印机里的墨水早就干了……然而,直到最近 Byteotian 气象组织(BOM)要求获取这些数据时,BIM 的员工才意识到这一点。

一位名叫 Byteasar 的热心实习生通过系统地记录 BIM 大楼北墙和南墙上两支家用酒精温度计显示的温度,挽救了局面。几十年前,BIM 的多位员工就已经确定:南墙温度计显示的温度绝不低于实际气温,而北墙温度计显示的温度绝不高于实际气温。因此,尽管每天的准确气温仍是个谜,但至少已知其所在的范围。

对所有人(除了 Byteasar 和你,或许)来说幸运的是,BOM 并不需要准确的温度。他们只想知道气温不下降的最长周期(即每一天的气温都不低于前一天)。事实上,BIM 的资深主管非常清楚,BOM 希望这个周期尽可能长。为了掩盖疏忽,他坚持要求 Byteasar 根据他宝贵的笔记,确定气温可能不下降的最长周期。这正是 Byteasar 在 BIM 实习期间没预料到的任务,他实在不知道该如何处理。他请求你帮忙编写一个程序,来确定这个最长的周期。

输入格式

标准输入的第一行包含一个整数 $n$ ($1 \le n \le 1\,000\,000$),表示 Byteasar 记录气温的天数。第 $i+1$ 行给出了第 $i$ 天的测量结果。每行包含两个整数 $x$ 和 $y$ ($-10^{9} \le x \le y \le 10^{9}$),分别表示两支温度计报告的当天可能的最低气温和最高气温。

在部分测试用例中,总分值为 50 分,气温从不低于 -50 度(如果你好奇的话,是摄氏度!),也从不超过 50 度 ($-50 \le x \le y \le 50$)。

输出格式

程序应在标准输出的第一行(也是唯一一行)打印一个整数,即 Byteotia 气温可能不下降的最长天数。

样例

输入 1

6
6 10
1 5
4 8
2 5
6 8
3 5

输出 1

4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.