Files
python/TangDou/CSP-J/AcWingTraining/T1/422_MoNi.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

25 lines
359 B
C++

#include <bits/stdc++.h>
using namespace std;
const int N = 10010;
int M, L;
bool st[N];
int res;
int main() {
cin >> L >> M;
while (M--) {
int l, r;
cin >> l >> r;
for (int i = l; i <= r; i++)
st[i] = true;
}
for (int i = 0; i <= L; i++)
if (!st[i])
res++;
cout << res << endl;
return 0;
}