#539
DFS
Se consideră un graf neorientat cu n
vârfuri și m
muchii și un vârf cunoscut X
. Să se afişeze vârfurile vizitate în urma parcurgerii în adâncime a grafului pornind din vârful X
.
Problema | DFS | Operații I/O |
dfs.in /dfs.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 128 MB
/
Stivă 8 MB
|
Id soluție | #20854066 | Utilizator | |
Fișier | dfs.cpp | Dimensiune | 378 B |
Data încărcării | 12 Februarie 2020, 13:50 | Scor / rezultat | Eroare de compilare |
dfs.cpp:5:1: error: expected ',' or ';' before 'fstream' fstream g("dfs.out",ios:out) ^ dfs.cpp: In function 'void df(int)': dfs.cpp:8:2: error: 'g' was not declared in this scope {g<<x<<' '; ^ dfs.cpp:9:1: error: 'v' was not declared in this scope v[x]=1; ^ dfs.cpp:10:5: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ dfs.cpp:10:12: error: 'n' was not declared in this scope for(i=1;i<=n;i++) ^ dfs.cpp:11:7: error: 'a' was not declared in this scope if(a[x][i]==1&&v[i]==0) dfs(i); ^ dfs.cpp:11:33: error: 'dfs' was not declared in this scope if(a[x][i]==1&&v[i]==0) dfs(i); ^ dfs.cpp: In function 'int main()': dfs.cpp:15:5: error: 'n' was not declared in this scope f>>n>>m>>c; ^ dfs.cpp:15:8: error: 'm' was not declared in this scope f>>n>>m>>c; ^ dfs.cpp:15:11: error: 'c' was not declared in this scope f>>n>>m>>c; ^ dfs.cpp:19:5: error: 'a' was not declared in this scope a[x][y]=a[y][x]=1; ^ dfs.cpp:21:4: error: 'd' was not declared in this scope d(c); ^ dfs.cpp:22:10: error: expected '}' at end of input return 0; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DFS face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.