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 1069. Prufer Code

Why memory limit
Posted by Filippov Ilia 18 Jan 2007 14:03
var
n,i,j,k:integer;
b,c:array[1..7500] of integer;
a:array[1..7500,1..7500] of integer;
begin
n:=0;
while not eoln do
begin
inc(n);
read(c[n]);
inc(b[c[n]]);
k:=c[n];
end;
i:=1;j:=1;
while (i<=k)and(j<=n) do
begin
while b[i]>0 do
inc(i);
a[c[j],i]:=1;
a[i,c[j]]:=1;
b[i]:=maxint;
if b[c[j]]>0 then dec(b[c[j]]);
if i>c[j] then i:=c[j];
inc(j);
if (i=k)and(b[k]=1) then break;
end;
for i:=1 to k do
begin
write(i,':');
for j:=1 to k do
if a[i,j]=1 then write(' ',j);
writeln;
end;
end.
Re: Why memory limit
Posted by Sandro (USU) 18 Jan 2007 15:01
a:array[1..7500,1..7500] of integer;

sizeof(a) = 7500*7500*4 > 200 MB!