#include <iostream>
using namespace std;
const int N = 100010;
int n, q;
int s[N], a[N];
int main()
{
cin >> n >> q;
for (int i = 1; i <= n; i ++ ) a[i] = 0;
while (q -- )
{
int l, r;
cin >> l >> r;
s[l]+=1,s[r+1]-=1;
}
for (int i =1;i <= n; i ++ )
{
s[i]+=s[i-1];
cout << s[i]<< ' ';
}
return 0;
}
这题为啥没用到a数组呢
这句
for (int i = 1; i <= n; i ++ ) a[i] = 0;
可以不用写