逆天,我在其他机构写的时候全AC了,一到这来就费了
不想多写文字了
#include <bits/stdc++.h>
using namespace std;
int main(){
int l,m;
int st,ed;
int ans = 0;
bool s[1111];
cin>>l>>m;
for(int i=0;i<=l;i++){
s[i] = true;
}
for(int i=1;i<=m;i++){
cin>>st>>ed;
for(int j=st;j<=ed;j++){
s[j] = false;
}
}
for(int i=0;i<=l;i++){
if(s[i] == true) ans++;
}
cout<<ans;
}