Files

25 lines
359 B
C++
Raw Permalink Normal View History

2025-08-30 18:35:01 +08:00
#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;
}