|
|
back to boardWHY WA#9??Can anyone help me?? Posted by zhl 17 Aug 2009 09:40 program p1028; var s,l:array[0..16000] of longint; x,y,n,tot,i:longint; procedure ins(x,left,right:longint); var mid:longint; begin mid:=(left+right) div 2; if x>mid then begin inc(tot,s[mid]); ins(x,mid+1,right); end; if x=mid then begin inc(tot,s[mid]); inc(s[mid]); end; if x<mid then begin inc(s[mid]); ins(x,left,mid-1); end; end; begin readln(n); for i:=1 to n do begin readln(x,y); tot:=0; ins(x,0,32002); inc(l[tot]); end; for i:=0 to n-1 do writeln(l[i]); end. Thx a lot!!! Edited by author 17.08.2009 09:40 Re: WHY WA#9??Can anyone help me?? i also WA#9 Orz Re: WHY WA#9??Can anyone help me?? So do I. Re: WHY WA#9??Can anyone help me?? It solves with binary tree or sqrt-decomposition. |
|
|