QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22681. Che mưa

Statistics

Trang trại gần đây chịu mưa nhiều bất thường. Bò thông minh muốn ăn cỏ không bị ướt nên dựng $N$ ô chữ nhật ($1 \le N \le 25{,}000$).

Đồng cỏ là một dải, mỗi ô che trọn một khoảng. Chúng dựng lộn xộn nên vài ô che toàn bộ hoặc một phần vùng của một hay nhiều ô khác. Tìm số ô khác lớn nhất được một ô duy nhất che hoàn toàn.

Dữ liệu vào

  • Dòng $1$: số nguyên $N$.

  • Các dòng $2..N+1$: số nguyên $A$ và $B$ cách nhau bằng dấu cách ($1 \le A < B \le 2{,}000{,}000{,}000$), hai đầu khoảng được che. Không hai ô nào chung đầu mút.

Dữ liệu ra

  • Dòng $1$: một số nguyên, số ô lớn nhất có vùng che nằm hoàn toàn trong vùng của một ô khác duy nhất.

Ví dụ

Dữ liệu vào 1

4
1 7
2 3
5 6
4 10

Dữ liệu ra 1

2

Ghi chú

Dữ liệu ra

Ô đầu che ô thứ hai và thứ ba như hình:

      *-----------*
      |           |
*-----------*
|           |
| *-*   *-* |
| | |   | | |
1 2 3 4 5 6 7 8 9 10

Nguồn bài: Alex Schwendner, 2003.

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.