#P2650. Bullet Screen Visibility Evaluation

    ID: 15916 Type: Default 1000ms 256MiB

Bullet Screen Visibility Evaluation

Bullet Screen Visibility Evaluation

zeromaker has a deep research on controlling the view of bullet screens (danmaku). Each bullet appears in zeromaker's view during a specific time interval \( [l_i, r_i] \). Outside this interval, the bullet is not visible. The difficulty of the picture increases as more bullets appear in the view, as it creates more interference.

Given the time intervals for each bullet and a query time interval \( [T_1, T_2] \), determine how many bullets are visible at least once during the query period. Two intervals \( [l_i, r_i] \) and \( [T_1, T_2] \) are considered overlapping if \( l_i \le T_2 \) and \( r_i \ge T_1 \).

inputFormat

The first line contains three integers: n, T1, and T2, where n is the number of bullets and \( [T1, T2] \) is the query time interval. Each of the next n lines contains two integers l and r representing the time interval \( [l, r] \) during which a bullet is visible.

outputFormat

Output a single integer representing the total number of bullets that appear in zeromaker's view during the query time interval.

sample

3 1 5
1 3
2 6
7 8
2