# include
<
stdio.h
>
int
a[
32005
], le[
15005
], n;
/*
*********************************************************
*/
int
getsum(
int
x)
{
int
ret
=
0
;
while
(x
>
0
) ret
+=
a[x], x
-=
(x
&
(
-
x));
return
ret;
}
void
inc(
int
x)
{
while
(x
<=
32005
)
++
a[x], x
+=
(x
&
(
-
x));
}
/*
*********************************************************
*/
int
main()
{
int
i, x, y;
scanf(
"
%d
"
,
&
n);
for
(i
=
0
; i
<
n;
++
i)
{
scanf(
"
%d%d
"
,
&
x,
&
y),
++
x;
++
le[getsum(x)];
inc(x);
}
for
(i
=
0
; i
<
n;
++
i) printf(
"
%d\n
"
, le[i]);
return
0
;
}
posted on 2012-09-02 10:21
yajunw 阅读(151)
评论(0) 编辑 收藏 引用