Processing math: 100%
Segment - MarisaOJ: Marisa 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≤n≤105. - 1≤l≤r≤109. ### Example Input: 56823562525 Output: 2