Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## FT.....USACO的数据都全对,但为什么WA?(程序内附)

Posted by JiangLY at 2005-07-05 21:30:07 on Problem 2457
```var
map:array[1..50000,0..1000] of word;
f:array[1..50000000,1..3] of word;
i,j,k,n,t,a,b,cl,op:longint;
procedure print;
var
i,l:integer;
way:array[1..50000] of word;
begin
i:=op;
writeln(f[op,3]);
l:=0;
while i<>0 do
begin
inc(l);
way[l]:=f[i,1];
i:=f[i,2];
end;
for i:=l downto 1 do writeln(way[i]);
end;
procedure search;
var
i:integer;
begin
for i:=1 to map[f[cl,1],0] do
begin
inc(op);
f[op,1]:=map[f[cl,1],i];
f[op,2]:=cl;
f[op,3]:=f[cl,3]+1;
if map[f[cl,1],i]=k then
begin
print;
halt;
end;
end;
end;
begin
for i:=1 to n do
begin
inc(map[a,0]);
map[a,map[a,0]]:=b;
end;
cl:=0;
op:=1;
f[1,1]:=1;
f[1,2]:=0;
f[1,3]:=1;
repeat
inc(cl);
search;
until cl>op;
writeln(-1);
end.
```

Followed by: