#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
using namespace std;
int n, levels[32005], c[32005];
int lowbit(int x)
{
return x & (-x);
}
int sum(int x)
{
int s = 0;
while (x > 0)
{
s += c[x];
x -= lowbit(x);
}
return s;
}
void update(int pos)
{
while (pos <= 32001)
{
c[pos]++;
pos += lowbit(pos);
}
}
int main()
{
cin>>n;
int x, y;
for (int i = 1; i <= n; i++)
{
cin>>x>>y;
levels[sum(x+1)]++;
update(x+1);
}
for (int i = 0; i < n; i++)
cout<<levels[i]<<endl;
}
poj 2352 Stars
最新推荐文章于 2020-07-28 22:29:13 发布