You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
376 B
22 lines
376 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
const int N = 10010;
|
|
|
|
int L, m;
|
|
bool st[N];
|
|
|
|
int main() {
|
|
cin >> L >> m;
|
|
while (m--) {
|
|
int l, r;
|
|
cin >> l >> r;
|
|
for (int i = l; i <= r; i++) st[i] = 1;
|
|
}
|
|
int res = 0;
|
|
for (int i = 0; i <= L; i++)
|
|
if (!st[i]) res++;
|
|
printf("%d\n", res);
|
|
return 0;
|
|
}
|