### Saratov State University :: Online Contester

::Go
- home
- news
- register
 - update personal info
 - problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- projects

 ::Poll Are you registered on Codeforces?YesNoWhat is it???[results]

::webboard

 Why Runtime Error on test 19
Author: logistic111
ID: 053132
Problem: 230
Contest: 0
Date: 2012-07-25 16:34:13

var
c,rty:array[0..100,0..100]of longint;
st,q:array[0..1000000]of byte;
g,st1:array[0..100]of byte;
f:array[0..100]of boolean;
str,q2,q1,mini,d,n,m,a,b,i,j,k,min,stn:longint;
begin
{ assign(input,'a.in');
reset(input);
assign(output,'a.out');
rewrite(output); }
stn:=0;
fillchar(c,sizeof(c),63);
fillchar(rty,sizeof(rty),63);
for i:=1 to n do c[0,i]:=1;
for i:=1 to m do
begin
c[a,b]:=1;
rty[a,b]:=1;
end;
for k:=1 to n do
for i:=1 to n do
for j:=1 to n do if (rty[i,j])>(rty[i,k]+rty[k,j]) then
rty[i,j]:=rty[i,k]+rty[k,j];
for i:=1 to n do for j:=1 to n do
if (rty[i,j]<1000000000)and(rty[j,i]<1000000000) then
begin
writeln('No solution');
halt;
end;
q2:=0;
q1:=0;
while 0=0 do
begin
if q2>q1 then break;
for j:=1 to n do if c[q[q2],j]=1 then
begin
inc(stn);
st[stn]:=j;
inc(q1);
q[q1]:=j;
end;
inc(q2);
end;
str:=n;
for i:=stn downto 1 do if f[st[i]]=false then
begin
st1[str]:=st[i];
f[st[i]]:=true;
dec(str);
end;
for i:=1 to n do g[st1[i]]:=n-i+1;
for i:=1 to n do write(g[i],' ');
end.