271. Minimum Arrows to Burst Balloons
MediumIntervals
Balloons are horizontal intervals [s, e]. An arrow shot at x bursts every balloon with s ≤ x ≤ e. Print the minimum number of arrows.
Input format
Line 1: n Next n lines: s e
Output format
The minimum arrows.
Example 1
Input
4 10 16 2 8 1 6 7 12
Output
2
Example 2
Input
4 1 2 3 4 5 6 7 8
Output
4
Constraints
1 ≤ n ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.
Loading the MyLoginn IDE…