report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Segment - FlandreOJ: Flandre Online Judge

Segment

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ line segments on the number line. Choose the maximum number of line segments such that no two line segments share a common point. ### Input - The first line contains two integers $n$. - The next $n$ lines each contain two integers $l, r$, representing a line segment extending from point $l$ to $r$ on the number line. ### Output - Print an integer, the maximum number of line segments that can be chosen. ### Constraints - $1 \le n \le 10^5$. - $1 \le l \le r \le 10^9$. ### Example Input: ``` 5 6 8 2 3 5 6 2 5 2 5 ``` Output: ``` 2 ```
Sorting
Points Sorting
Brewing potion
Smallest possible
Distance minimization
Segment
Cucumber
Maximum value arrangement
Buttons game
Building fence
Balance
Topic
Sorting
Rating 900
Solution (1) Solution