https://ac.nowcoder.com/acm/contest/322/M
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long LL;
const int maxN=1e6+5;
int ans[200005],a[maxN],N;
int main()
{
cin>>N;
int l,r;
for(int i=1;i<=N;i++)
{
scanf("%d%d",&l,&r);
a[l]++;
a[r+1]--;
}
ans[a[0]]++;
for(int i=1;i<=1000000;i++)
{
a[i]+=a[i-1];
ans[a[i]]++;
}
for(int i=1;i<N;i++)printf("%d ",ans[i]);
printf("%d\n",ans[N]);
return 0;
}