QOJ.ac

QOJ

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

#22681. Riparo dalla pioggia

Statistics

La fattoria ha subito piogge straordinarie. Per pascolare all'asciutto, le ingegnose mucche installano $N$ ombrelli rettangolari ($1 \le N \le 25{,}000$).

Il campo è una striscia d'erba; ogni ombrello copre interamente un intervallo. Sono disordinati e alcuni coprono tutta o parte dell'area di uno o più altri. Trova il massimo numero di altri ombrelli interamente coperti da uno solo.

Input

  • Riga $1$: un intero $N$.

  • Righe $2..N+1$: interi $A$ e $B$ separati da spazio ($1 \le A < B \le 2{,}000{,}000{,}000$), estremi dell'intervallo coperto. Nessun estremo è condiviso da due ombrelli.

Output

  • Riga $1$: un intero, massimo di ombrelli interamente contenuti nell'area di un unico altro ombrello.

Esempi

Input 1

4
1 7
2 3
5 6
4 10

Output 1

2

Note

Output

Il primo copre il secondo e il terzo, come sotto:

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

Crediti: 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.