#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 | #56885799 | Utilizator | |
Fișier | dfs.cpp | Dimensiune | 488 B |
Data încărcării | 10 Martie 2025, 01:10 | Scor / rezultat | Eroare de compilare |
dfs.cpp:6:15: warning: missing terminating " character [enabled by default] ifstream fin ("dfs.in); ^ dfs.cpp:6:1: error: missing terminating " character ifstream fin ("dfs.in); ^ dfs.cpp:7:14: error: expected ',' or '...' before '(' token ofstream fout("dfs.out"); ^ dfs.cpp:7:25: error: expected ')' before ';' token ofstream fout("dfs.out"); ^ dfs.cpp: In function 'void DFS(int)': dfs.cpp:14:5: error: 'fout' was not declared in this scope fout << x << ' '; ^ dfs.cpp: In function 'int main()': dfs.cpp:24:12: error: invalid operands of types 'std::ifstream(std::ofstream) {aka std::basic_ifstream<char>(std::basic_ofstream<char>)}' and 'int' to binary 'operator>>' fin >> n >> m >> x; ^ dfs.cpp:28:16: error: invalid operands of types 'std::ifstream(std::ofstream) {aka std::basic_ifstream<char>(std::basic_ofstream<char>)}' and 'int' to binary 'operator>>' fin >> i >> j ; ^
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ă.