var
a:array [1..200,1..200] of integer;
used,p:array [1..200] of boolean;
n,m,i,j,s,f,max,t,sol:integer;
d:boolean;
begin
{assign(input,'in.put');reset(input);}
readln(n,m);
for i:=1 to m do
begin
readln(s,f);
a[f,s]:=1;
end;
m:=n;max:=0;
while m>0 do
begin
inc(sol);
t:=0;
for i:=1 to n do
if not used[i] then
begin
d:=true;
for j:=1 to n do
if (a[i,j]<>0) and (not used[j]) then d:=false;
p[i]:=d;
if d then begin inc(t); dec(m); end;
end;
for j:=1 to n do begin used[j]:=used[j] or p[j]; p[j]:=false; end;
if max<t then max:=t;
end;
max:=1;
while max*sol<n do inc(max);
writeln(sol,' ',max);
end.
Бидний гаргасан амжилтууд (Team SMCS1)
12 лет назад
1 комментарий:
Buruu bodolt baina.
Отправить комментарий