#539
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 | #64271812 | Utilizator | |
| Fișier | dfs.cpp | Dimensiune | 393 B |
| Data încărcării | 27 Aprilie 2026, 13:17 | Scor/rezultat | Eroare de compilare |
dfs.cpp: In function ‘void citire()’: dfs.cpp:11:8: error: ‘x’ was not declared in this scope 11 | {cin>>x>>y; | ^ dfs.cpp:11:11: error: ‘y’ was not declared in this scope 11 | {cin>>x>>y; | ^ dfs.cpp: In function ‘void dfs(int)’: dfs.cpp:16:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 16 | if(a[k][i]=1 && v[i]==0) | ~~~~~~~^~~~~~~~~~~~~ dfs.cpp:15:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 15 | for(int i=1;i<=m;i++) | ^~~ dfs.cpp:18:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 18 | int main() | ^~~ dfs.cpp:18:14: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 18 | int main() | ^~ dfs.cpp:18:14: note: remove parentheses to default-initialize a variable 18 | int main() | ^~ | -- dfs.cpp:18:14: note: or replace parentheses with braces to value-initialize a variable dfs.cpp:19:2: error: a function-definition is not allowed here before ‘{’ token 19 | {citire(); | ^ dfs.cpp:20:11: error: expected ‘}’ at end of input 20 | dfs(x);} | ^ dfs.cpp:14:1: note: to match this ‘{’ 14 | {v[k]=1; cout<<k<<" "; | ^
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ă.