- 弱弱的战壕
- 2014-04-19 15:54:51 @
Const
Maxn=32005;
Var
sum: array[0..maxn]of Longint;
a: array[0..maxn]of Longint;
x,y,i,n: Longint;
Function Lowbit(x: Longint): Longint;
Begin
Exit(x And (-x));
End;
Procedure Change(k,delta: Longint);
Begin
While (k<=Maxn) Do Begin
Inc(sum[k],delta);
Inc(k,Lowbit(k));
End;
End;
Function Getsum(k: Longint): Longint;
Begin
Getsum:=0;
While (k>0) Do Begin
Inc(Getsum,sum[k]);
Dec(k,Lowbit(k));
End;
End;
Begin
Readln(n);
For i:=1 To n Do Begin
Readln(x,y);
Inc(x);
Change(x,1);
Inc(a[Getsum(x)-1]);
End;
For i:=0 To n-1 Do
writeln(a[i]);
End.
1 条评论
-
ERICFXY LV 8 @ 2014-07-31 13:27:47
=。=
- 1