Cod sursa(job #153564)
Utilizator | Data | 10 martie 2008 16:52:10 | |
---|---|---|---|
Problema | Parcurgere DFS - componente conexe | Scor | 15 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
var n,m,i,cnx,x,y:longint;
t:array[1..100000]of byte;
begin
assign(input,'dfs.in');
reset(input);
read(n,m);
for i:=1 to m do
begin
read(x,y);
t[y]:=1;
end;
close(input);
for i:=1 to n do
if(t[i]=0)then
cnx:=cnx+1;
assign(output,'dfs.out');
rewrite(output);
write(cnx);
close(output);
end.