Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
23028 | LeoWang | 校门外的树 | C++ | Accepted | 1 MS | 636 KB | 304 | 2023-07-20 18:37:35 |
#include<bits/stdc++.h> using namespace std; int main(){ int L,M,c,d,sum=0; cin>>L; cin>>M; int a[100000]={}; for(int i=0;i<M;i++){ cin>>c>>d; for(int i=c;i<=d;i++){ if(a[i]==0) a[i]=1; } } for(int i=0;i<=L;i++){ if(a[i]==0) sum++; } cout<<sum; return 0; }