#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
#define PF(x) (scanf("%d",&x))
#define PT(x,y) (scanf("%d%d",&x,&y))
#define PR(x) (printf("%d\n",x))
#define PRT(x,y)(printf("%d %d\n",x,y))
#define M 100005
int ar[M];
int low(int x)
{
return x&(-x);
}
void add(int id,int y)
{
for(;id<M;id+=low(id))
ar[id] += y;
}
int sumt(int a)
{
int su = 0;
for(;a;a-=low(a))
su += ar[a];
return su;
}
void init()
{
int n;
while(true)
{
PF(n);
if(n == 0) break;
int a,b;
memset(ar,0,sizeof(ar));
for(int i=0;i<n;i++)
{
PT(a,b);
add(a,1);
add(b+1,-1);
}
for(int i=1;i<=n;i++)
{
if(i!=1) printf(" %d",sumt(i));
else printf("%d",sumt(i));
}
puts("");
}
return ;
}
int main()
{
init();
return 0;
}
hdu 1556
最新推荐文章于 2020-02-28 14:28:14 发布