|
|
back to boardwhy wa? var s:array[1..32000]of longint; ans:array[0..15000]of longint; n,i,x,y,t,k:longint; begin readln(n); for i:=1 to n do begin readln(x,y); t:=0; inc(x); k:=x; while k>0 do begin t:=t+s[k]; k:=k-k and (k xor (k-1)); end; ans[t]:=ans[t]+1; k:=x; while k<=32000 do begin s[k]:=s[k]+1; k:=k+k and (k xor (k-1)); end; end; for i:=0 to n-1 do writeln(ans[i]); end. |
|
|