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

Note

פלט

הראשונה מכסה את השנייה והשלישית, כמוצג:

      *-----------*
      |           |
*-----------*
|           |
| *-*   *-* |
| | |   | | |
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.