#438
Se dă lista muchiilor unui graf neorientat. Să se afișeze componentele conexe ale acestui graf.
| Problema | ComponenteConexe | Operații I/O |
componenteconexe.in/componenteconexe.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64652328 | Utilizator | |
| Fișier | componenteconexe.cpp | Dimensiune | 1003 B |
| Data încărcării | 20 Mai 2026, 16:32 | Scor/rezultat | Eroare de compilare |
componenteconexe.cpp:3:13: error: variable ‘std::ifstream fin’ has initializer but incomplete type 3 | ifstream fin("componenteconexe.in"); | ^ componenteconexe.cpp:4:14: error: variable ‘std::ofstream fout’ has initializer but incomplete type 4 | ofstream fout("componenteconexe.out"); | ^ componenteconexe.cpp:5:34: error: expected initializer before ‘n’ 5 | int a[100][100],lee[100],viz[100]n,m,pr,ul,x,t,nrc; | ^ componenteconexe.cpp: In function ‘void citire()’: componenteconexe.cpp:8:12: error: ‘n’ was not declared in this scope 8 | fin >> n; | ^ componenteconexe.cpp: In function ‘void bfs(int, int)’: componenteconexe.cpp:17:4: error: ‘pr’ was not declared in this scope 17 | { pr=1;ul=1; | ^~ componenteconexe.cpp:17:9: error: ‘ul’ was not declared in this scope 17 | { pr=1;ul=1; | ^~ componenteconexe.cpp:19:1: error: ‘viz’ was not declared in this scope 19 | viz[t]=nrc; | ^~~ componenteconexe.cpp:24:20: error: ‘n’ was not declared in this scope 24 | for(int i=1;i<=n;i++) | ^ componenteconexe.cpp: In function ‘int main()’: componenteconexe.cpp:39:20: error: ‘n’ was not declared in this scope 39 | for(int i=1;i<=n;i++) | ^ componenteconexe.cpp:41:12: error: ‘viz’ was not declared in this scope 41 | if(viz[i]==0) | ^~~ componenteconexe.cpp:43:13: error: ‘nrc’ was not declared in this scope 43 | nrc++; | ^~~ componenteconexe.cpp:47:12: error: ‘nrc’ was not declared in this scope 47 | fout << nrc << endl; | ^~~ componenteconexe.cpp:50:23: error: ‘n’ was not declared in this scope 50 | for(int j=1;j<=n;j++) | ^ componenteconexe.cpp:52:15: error: ‘viz’ was not declared in this scope 52 | if(viz[j]==i) | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ComponenteConexe 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ă.