ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1028. Stars

WHY 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??
Posted by Shyu SeiMin 8 Sep 2009 11:21
i also WA#9 Orz
Re: WHY WA#9??Can anyone help me??
Posted by clavichord 25 Apr 2010 17:54
So do I.
Re: WHY WA#9??Can anyone help me??
Posted by dAFTc0d3r [Yaroslavl SU] 26 Apr 2010 10:01
It solves with binary tree or sqrt-decomposition.