#4282
Dându-se un graf neorientat cu n noduri și m muchii, să se determine numărul componentelor conexe.
| Problema | NrCompConexe1 | Operații I/O |
nrcompconexe.in/nrcompconexe.out
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 32 MB
|
| Id soluție | #62614104 | Utilizator | |
| Fișier | nrcompconexe1.cpp | Dimensiune | 343 B |
| Data încărcării | 27 Ianuarie 2026, 17:37 | Scor/rezultat | Eroare de compilare |
nrcompconexe1.cpp: In function 'int find(int)': nrcompconexe1.cpp:2:9: error: 'parent' was not declared in this scope if (parent[x] != x) ^ nrcompconexe1.cpp:4:12: error: 'parent' was not declared in this scope return parent[x]; ^ nrcompconexe1.cpp: In function 'void unite(int, int)': nrcompconexe1.cpp:11:9: error: 'rank' was not declared in this scope if (rank[px] < rank[py]) swap(px, py); ^ nrcompconexe1.cpp:11:41: error: 'swap' was not declared in this scope if (rank[px] < rank[py]) swap(px, py); ^ nrcompconexe1.cpp:12:5: error: 'parent' was not declared in this scope parent[py] = px; ^ nrcompconexe1.cpp:13:9: error: 'rank' was not declared in this scope if (rank[px] == rank[py]) rank[px]++; ^ nrcompconexe1.cpp: In function 'int find(int)': nrcompconexe1.cpp:5:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NrCompConexe1 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ă.