QOJ.ac

QOJ

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

#22681. 遮雨

Statistics

最近農場雨量異常大。聰明的牛想吃草時不淋雨,搭起 $N$ 把矩形傘($1 \le N \le 25{,}000$)遮雨。

草地是一條草帶,每把傘完整覆蓋一個區間。傘搭得雜亂,部分覆蓋了其他一把或多把傘區域的全部或部分。求一把傘能完整覆蓋的其他傘數量最大值。

輸入格式

  • 第 $1$ 行:整數 $N$。

  • 第 $2..N+1$ 行:以空格分隔的整數 $A$、$B$($1 \le A < B \le 2{,}000{,}000{,}000$),表示一把傘覆蓋區間的端點。任兩把傘都沒有相同端點。

輸出格式

  • 第 $1$ 行:一個整數,某一把傘範圍內完整包含的其他傘的最大數量。

範例

輸入格式 1

4
1 7
2 3
5 6
4 10

輸出格式 1

2

說明

輸出格式

第一把傘覆蓋第二、第三把,如下圖:

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

題目來源: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.