#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 | #64271641 | Utilizator | |
| Fișier | dfs.cpp | Dimensiune | 451 B |
| Data încărcării | 27 Aprilie 2026, 13:11 | Scor/rezultat | Eroare de compilare |
dfs.cpp: In function ‘void dfs(int)’: dfs.cpp:17:10: error: expected primary-expression before ‘<’ token 17 | cout,<" "; | ^ dfs.cpp:18:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 18 | for(int i=1;i<=n;i++) | ^~~ dfs.cpp:21:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 21 | int main() { | ^~~ dfs.cpp:21:17: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 21 | int main() { | ^~ dfs.cpp:21:17: note: remove parentheses to default-initialize a variable 21 | int main() { | ^~ | -- dfs.cpp:21:17: note: or replace parentheses with braces to value-initialize a variable dfs.cpp:21:20: error: a function-definition is not allowed here before ‘{’ token 21 | int main() { | ^ dfs.cpp:23:16: error: expected ‘}’ at end of input 23 | dfs(x); | ^ dfs.cpp:15:17: note: to match this ‘{’ 15 | void dfs(int 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ă.