/* ***********************************************
Author :xryz
Email :523689985@qq.com
Created Time :4-21 21:20:06
File Name :a.cpp
************************************************ */
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
const int N=32000+5;
int c[N],a[N];
int lowbit(int x)
{
return x&-x;
}
int sum(int x)
{
int ret=0;
while(x>0)
{
ret+=c[x];
x-=lowbit(x);
}
return ret;
}
void add(int x,int d)
{
while(x<=N)
{
c[x]+=d;
x+=lowbit(x);
}
}
int main()
{
int n,i,x,y,t;
while(~scanf("%d",&n))
{
memset(c,0,sizeof(c));
memset(a,0,sizeof(a));
for(i=0;i<n;i++)
{
scanf("%d%d",&x,&y);
add(x+1,1);
a[sum(x+1)]++;
}
for(i=1;i<=n;i++)
printf("%d
",a[i]);
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。http://xiang578.top/