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

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