#583
Tare conexitate
Se dă un graf orientat cu n
noduri. Să se determine câte componente tare conexe are graful dat.
Problema | Tare conexitate | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57898386 | Utilizator | |
Fișier | tare_conexitate.cpp | Dimensiune | 1.39 KB |
Data încărcării | 29 Aprilie 2025, 19:32 | Scor / rezultat | Eroare de compilare |
tare_conexitate.cpp:4:20: error: 'vector' has not been declared void dfs1(int nod, vector<vector<int>> adj, vector<int> &visited, stack<int> &S) { ^ tare_conexitate.cpp:4:26: error: expected ',' or '...' before '<' token void dfs1(int nod, vector<vector<int>> adj, vector<int> &visited, stack<int> &S) { ^ tare_conexitate.cpp: In function 'void dfs1(int, int)': tare_conexitate.cpp:5:5: error: 'visited' was not declared in this scope visited[nod] = 1; ^ tare_conexitate.cpp:6:18: error: 'adj' was not declared in this scope for (int v : adj[nod]) { ^ tare_conexitate.cpp:8:35: error: 'S' was not declared in this scope dfs1(v, adj, visited, S); ^ tare_conexitate.cpp:11:5: error: 'S' was not declared in this scope S.push(nod); ^ tare_conexitate.cpp: At global scope: tare_conexitate.cpp:13:20: error: 'vector' has not been declared void dfs2(int nod, vector<vector<int>> adj, vector<int> &visited) { ^ tare_conexitate.cpp:13:26: error: expected ',' or '...' before '<' token void dfs2(int nod, vector<vector<int>> adj, vector<int> &visited) { ^ tare_conexitate.cpp: In function 'void dfs2(int, int)': tare_conexitate.cpp:14:5: error: 'visited' was not declared in this scope visited[nod] = 1; ^ tare_conexitate.cpp:15:18: error: 'adj' was not declared in this scope for (int v : adj[nod]) { ^ tare_conexitate.cpp: At global scope: tare_conexitate.cpp:21:22: error: 'vector' has not been declared void Kosaraju(int n, vector<vector<int>> adj) { ^ tare_conexitate.cpp:21:28: error: expected ',' or '...' before '<' token void Kosaraju(int n, vector<vector<int>> adj) { ^ tare_conexitate.cpp: In function 'void Kosaraju(int, int)': tare_conexitate.cpp:22:5: error: 'stack' was not declared in this scope stack<int> S; ^ tare_conexitate.cpp:22:11: error: expected primary-expression before 'int' stack<int> S; ^ tare_conexitate.cpp:22:11: error: expected ';' before 'int' tare_conexitate.cpp:23:5: error: 'vector' was not declared in this scope vector<int> visited(n + 1, 0); ^ tare_conexitate.cpp:23:12: error: expected primary-expression before 'int' vector<int> visited(n + 1, 0); ^ tare_conexitate.cpp:23:12: error: expected ';' before 'int' tare_conexitate.cpp:25:14: error: 'visited' was not declared in this scope if (!visited[i]) { ^ tare_conexitate.cpp:26:21: error: 'adj' was not declared in this scope dfs1(i, adj, visited, S); ^ tare_conexitate.cpp:26:35: error: 'S' was not declared in this scope dfs1(i, adj, visited, S); ^ tare_conexitate.cpp:30:19: error: expected primary-expression before 'int' vector<vector<int>> adjT(n + 1); ^ tare_conexitate.cpp:30:19: error: expected ';' before 'int' tare_conexitate.cpp:32:22: error: 'adj' was not declared in this scope for (int v : adj[i]) { ^ tare_conexitate.cpp:33:13: error: 'adjT' was not declared in this scope adjT[v].push_back(i); ^ tare_conexitate.cpp:37:10: error: 'visited' was not declared in this scope fill(visited.begin(), visited.end(), 0); ^ tare_conexitate.cpp:39:13: error: 'S' was not declared in this scope while (!S.empty()) { ^ tare_conexitate.cpp:42:22: error: 'adjT' was not declared in this scope for (int v : adjT[nod]) { ^ tare_conexitate.cpp: In function 'int main()': tare_conexitate.cpp:53:5: error: 'vector' was not declared in this scope vector<vector<int>> adj(n + 1); ^ tare_conexitate.cpp:53:19: error: expected primary-expression before 'int' vector<vector<int>> adj(n + 1); ^ tare_conexitate.cpp:53:19: error: expected ';' before 'int' tare_conexitate.cpp:56:9: error: 'adj' was not declared in this scope adj[i].push_back(j); ^ tare_conexitate.cpp:58:17: error: 'adj' was not declared in this scope Kosaraju(n, adj); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Tare conexitate 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ă.