#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=15010;
const int maxlen=32010;
int tree[4*maxn];
int lowbit(int n)
{
return (n&-n);
}
int getsum(int i)
{
int sum=0;
while(i>0)
{
sum+=tree[i];
i-=lowbit(i);
}
return sum;
}
void update(int i,int dx)
{
while(i<=maxlen)
{
tree[i]+=dx;
i+=lowbit(i);
}
}
int main()
{
int n;
int x,y;int i;
int ans[maxn];
while(scanf("%d",&n)!=EOF)
{
memset(ans,0,sizeof(ans));
memset(tree,0,sizeof(tree));
for(i=0;i<n;i++)
{
int x,y;
scanf("%d%d",&x,&y);
x++;
ans[getsum(x)]++;
update(x,1);
}
for(i=0;i<n;i++)
printf("%d\n",ans[i]);
}
return 0;
}
时间: 2024-11-05 15:45:00