0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-26 21:12:01 +00:00
OI-codes/Luogu/P1047/P1047.cpp

22 lines
358 B
C++
Raw Normal View History

#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;
}