Please, tell me my mistake! WA#4 Code is inside
I'll delete it after finding mistakes.
Const c:array[boolean] of String[3]=('NO','YES');
Var a:array[1..100,0..100] of longint;
f:array[1..100,1..100] of boolean;
b:array[1..100,1..100] of longint;
fl,cl:array[1..100] of boolean;
n,m,s:longint;
i:longint;
count:longint;
Procedure Output(r:boolean); Forward;
Procedure Input;
Var ot,ku,sk:longint;
i:longint;
Begin
Readln(m,n,s);
For i:=1 to n do
Begin
Readln(ot,ku,sk);
If b[ot,ku]>0 then Output(true);
inc(a[ot,0]); a[ot,a[ot,0]]:=ku;
inc(a[ku,0]); a[ku,a[ku,0]]:=ot;
f[ot,ku]:=true; f[ku,ot]:=true;
b[ot,ku]:=sk; b[ku,ot]:=sk;
End;
End;
Procedure Rec(nom:byte; k:longint);
Var j:byte;
Begin
If fl[nom] then Output(true);
If k>count then count:=k;
fl[nom]:=true;
For j:=1 to a[nom,0] do
If f[nom,a[nom,j]] then
Begin
f[nom,a[nom,j]]:=false; f[a[nom,j],nom]:=false;
Rec(a[nom,j],k+b[nom,a[nom,j]]);
f[a[nom,j],nom]:=true; f[nom,a[nom,j]]:=true;
End;
fl[nom]:=false;
End;
Procedure Output(r:boolean); Begin Writeln(c[r]); Halt; End;
BEGIN
Input;
For i:=1 to m do Rec(i,0);
Output(s mod count=0);
END.
WA#4. But If I write Output(false) in the line before last,
I have WA#9... Please, help.
Thanks.
Edited by author 06.06.2006 17:17
Edited by author 08.06.2006 13:17