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 1022. Genealogical Tree

HELP!! HELP!!
Posted by byron1990 29 Nov 2007 10:16
Why this program is wrong?
Who can help me?

var
        i,j,k,m,n,l     :longint;
        d               :array[1..1000]of longint;
        boo             :array[1..100,1..100]of boolean;

begin
        fillchar(boo,sizeof(boo),false);
        readln(n);
        for i:=1 to n do
                begin
                        while not eoln do
                                begin
                                        read(k);
                                        if k<>0 then begin
                                                        boo[i,k]:=true;
                                                        inc(d[k]);
                                                     end;
                                end;
                        readln;
                end;
        for i:=1 to n do
                begin
                        j:=1;
                        while (d[j]<>0)and(j<=n) do inc(j);
                        write(j,' ');
                        d[j]:=maxlongint;
                        for l:=1 to n do
                                if boo[j,l]=true then begin
                                                        dec(d[l]);
                                                        boo[j,l]:=false ;
                                                      end;
                end;
end.