QOJ.ac

QOJ

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

#22681. Regenschutz

Statistics

Die Farm hat ungewöhnlich viel Regen erlebt. Um trocken zu grasen, stellen die erfinderischen Kühe $N$ rechteckige Schirme ($1 \le N \le 25{,}000$) auf.

Die Wiese ist ein Grasstreifen, jeder Schirm bedeckt ein ganzes Intervall. Sie sind ungeordnet aufgestellt, und einige bedecken ganz oder teilweise Bereiche eines oder mehrerer anderer. Finde die größte Zahl anderer Schirme, die vollständig von einem einzigen bedeckt werden.

Eingabe

  • Zeile $1$: eine ganze Zahl $N$.

  • Zeilen $2..N+1$: ganze Zahlen $A$ und $B$ durch Leerzeichen getrennt ($1 \le A < B \le 2{,}000{,}000{,}000$), Endpunkte des Intervalls. Keine zwei Schirme teilen einen Endpunkt.

Ausgabe

  • Zeile $1$: eine ganze Zahl, maximale Anzahl vollständig im Bereich eines einzigen anderen Schirms liegender Schirme.

Beispiele

Eingabe 1

4
1 7
2 3
5 6
4 10

Ausgabe 1

2

Hinweis

Ausgabe

Der erste bedeckt den zweiten und dritten, wie unten:

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

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