#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 | #62648905 | Utilizator | |
| Fișier | dfs.cpp | Dimensiune | 445 B |
| Data încărcării | 28 Ianuarie 2026, 16:05 | Scor/rezultat | Eroare de compilare |
dfs.cpp:4:14: error: variable 'std::ifstream fin' has initializer but incomplete type ifstream fin (" dfs.in ") ^ dfs.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream fout ( "dfs.out ") ^ dfs.cpp: In function 'void dfs(int)': dfs.cpp:11:5: error: 'fout' was not declared in this scope fout << v << " "; ^ dfs.cpp:12:5: error: 'P' was not declared in this scope P[v] == 1 ^ dfs.cpp:13:5: error: expected ';' before 'for' for ( int i = 1 ; i <=n; i ++) ^ dfs.cpp:13:23: error: 'i' was not declared in this scope for ( int i = 1 ; i <=n; i ++) ^ dfs.cpp:13:27: error: 'n' was not declared in this scope for ( int i = 1 ; i <=n; i ++) ^ dfs.cpp:13:34: error: expected ';' before ')' token for ( int i = 1 ; i <=n; i ++) ^ dfs.cpp: In function 'int main()': dfs.cpp:18:12: error: 'n' was not declared in this scope fin >> n >> m >> p; ^ dfs.cpp:18:17: error: 'm' was not declared in this scope fin >> n >> m >> p; ^ dfs.cpp:18:22: error: 'p' was not declared in this scope fin >> n >> m >> p; ^ dfs.cpp:21:16: error: 'x' was not declared in this scope fin >> x >> y; ^ dfs.cpp:21:21: error: 'y' was not declared in this scope fin >> x >> y; ^ dfs.cpp:22:9: error: 'a' was not declared in this scope a[x][y] = a[y][x] = 1; ^
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ă.