mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-05 09:18:47 +00:00
22 lines
358 B
C++
22 lines
358 B
C++
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int l, m, u, v, ans;
|
||
|
bool t[10005];
|
||
|
|
||
|
int main() {
|
||
|
cin >> l >> m;
|
||
|
for (int i = 0; i < m; i++) {
|
||
|
cin >> u >> v;
|
||
|
for (int j = u; j <= v; j++) {
|
||
|
t[j] = true;
|
||
|
}
|
||
|
}
|
||
|
for (int i = 0; i <= l; i++) {
|
||
|
ans += !t[i];
|
||
|
}
|
||
|
cout << ans << endl;
|
||
|
return 0;
|
||
|
}
|