#P1840. Count the Remaining Black Points
Count the Remaining Black Points
Count the Remaining Black Points
There is a number line with n points, which are labeled as $1,2,\ldots,n$. Initially, all points are colored black. Then, m operations are performed. In the i-th operation, all points in the interval $[l_i, r_i]$ are repainted white. After each operation, output the number of points that remain black.
Note: The operations are performed sequentially, and once a point becomes white, it will remain white in subsequent operations.
inputFormat
The first line contains two integers n and m ($1 \le n, m \le 10^5$), representing the number of points and the number of operations.
Each of the next m lines contains two integers li and ri ($1 \le l_i \le r_i \le n$), representing the range of points to be painted white in the i-th operation.
outputFormat
For each operation, print a single line containing the number of points that remain black after the operation.
sample
10 3
2 5
4 7
8 10
6
4
1
</p>