QOJ.ac

QOJ

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

#22681. Cubierta para la lluvia

Statistics

La granja ha sufrido lluvias extraordinarias. Para pastar sin mojarse, las ingeniosas vacas instalan $N$ paraguas rectangulares ($1 \le N \le 25{,}000$).

El campo es una franja de hierba; cada paraguas cubre por completo un intervalo. Están desordenados y algunos cubren toda o parte del área de uno o más otros. Halla el máximo de otros paraguas cubiertos por completo por uno solo.

Entrada

  • Línea $1$: un entero $N$.

  • Líneas $2..N+1$: enteros $A$ y $B$ separados por espacio ($1 \le A < B \le 2{,}000{,}000{,}000$), extremos del intervalo cubierto. Ningún extremo es compartido por dos paraguas.

Salida

  • Línea $1$: un entero, máximo de paraguas cuya cobertura está enteramente dentro de la de otro único paraguas.

Ejemplos

Entrada 1

4
1 7
2 3
5 6
4 10

Salida 1

2

Nota

Salida

El primero cubre el segundo y tercero, como se muestra:

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

Créditos: 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.