QOJ.ac

QOJ

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

#22483. Máy nước ngọt

Statistics

Đáp ứng nhu cầu tăng của $N$ bò ($1 \le N \le 50,000$), Farmer John mua máy nước ngọt mới và tìm chỗ tốt nhất.

Đồng là trục số một chiều. Bò $i$ ăn trong $A_i..B_i$ ($1 \le A_i \le B_i; A_i \le B_i \le 1,000,000,000$), gồm hai đầu. Máy ở bất kỳ điểm nguyên trong $1..1,000,000,000$. Bò lười muốn đi ít và máy trong đoạn mình.

Không luôn thỏa mọi bò. FJ muốn số bò lớn nhất thỏa.

Bốn đoạn $3..5$, $4..8$, $1..2$, $5..10$ minh họa dưới:

         1   2   3   4   5   6   7   8   9  10  11  12  13
         |---|---|---|---|---|---|---|---|---|---|---|---|-...
                 aaaaaaaaa
                     bbbbbbbbbbbbbbbbb
         ccccc           ddddddddddddddddddddd

Bò đầu, hai, tư chung $5$, bò ba không giao. Tối đa 3 có máy trong đoạn.

Dữ liệu vào

  • Dòng 1: số nguyên $N$.
  • Dòng $2..N+1$: dòng $i+1$ hai số nguyên $A_i$, $B_i$ cách bởi khoảng trắng.

Dữ liệu ra

  • Dòng 1: số nguyên, số bò lớn nhất mà tất cả đoạn của chúng có thể chứa máy.

Ví dụ

Dữ liệu vào 1

4
3 5
4 8
1 2
5 10

Dữ liệu ra 1

3

Ghi chú

Tại $5$ thỏa bò 1, 2, 4; cả bốn không thể.

Tác giả bài toán: Neal Wu, 2008.

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.