#P3740. [HAOI2014] 贴海报
[HAOI2014] 贴海报
Description
The city of Bytetown is holding a mayoral election, and all voters can freely express their opinions about the candidates. For unified management, the city committee has prepared an electoral wall for voters to post posters.
The posting rules are as follows:
- The electoral wall is a rectangle of length units, with each unit being a cell.
- The height of every posted poster must be the same as the height of the electoral wall.
- Each poster is denoted by
A B, meaning it covers from cell to cell . - A later poster may cover earlier posters or parts of them.
Please determine how many posters are still visible on the electoral wall after all posters have been posted.
Input Format
The first line contains two positive integers and , the length of the electoral wall and the number of posters, respectively.
Each of the next lines contains two positive integers and , denoting the position covered by a poster.
All numbers are positive integers, separated by a single space.
Output Format
Output the number of posters that remain visible after all posters have been posted.
100 5
1 4
2 6
8 10
3 4
7 10
4
Hint

Constraints
, , .
Translated by ChatGPT 5
京公网安备 11011102002149号