#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 | #64907839 | Utilizator | |
| Fișier | dfs.cpp | Dimensiune | 533 B |
| Data încărcării | 11 Iunie 2026, 15:33 | Scor/rezultat | Eroare de compilare |
dfs.cpp:5:14: warning: character constant too long for its type 5 | ifstream fin('DFS.in'); | ^~~~~~~~ dfs.cpp:6:15: warning: character constant too long for its type 6 | ofstream fout('DFS.out'); | ^~~~~~~~~ dfs.cpp:5:14: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive] 5 | ifstream fin('DFS.in'); | ^~~~~~~~ | | | int In file included from dfs.cpp:2: /usr/include/c++/13/fstream:536:34: note: initializing argument 1 of ‘std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::ios_base::openmode]’ 536 | basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in) | ~~~~~~~~~~~~^~~ dfs.cpp:6:15: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive] 6 | ofstream fout('DFS.out'); | ^~~~~~~~~ | | | int /usr/include/c++/13/fstream:797:34: note: initializing argument 1 of ‘std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::ios_base::openmode]’ 797 | basic_ofstream(const char* __s, | ~~~~~~~~~~~~^~~
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ă.