#441
Se dă lista muchiilor unui graf neorientat. Să se determine numărul minim de muchii care trebuie adăugate pentru ca graful să devină conex, precum și un set de asemenea muchii.
| Problema | ComponenteConexe1 | Operații I/O |
componenteconexe1.in/componenteconexe1.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64712944 | Utilizator | |
| Fișier | componenteconexe1.cpp | Dimensiune | 1.18 KB |
| Data încărcării | 25 Mai 2026, 16:30 | Scor/rezultat | Eroare de compilare |
componenteconexe1.cpp:2:17: error: expected ‘]’ before numeric constant 2 | #define NMAX 1 05 | ^~ componenteconexe1.cpp:11:11: note: in expansion of macro ‘NMAX’ 11 | int v[NMAX]; | ^~~~ componenteconexe1.cpp:2:17: error: expected ‘]’ before numeric constant 2 | #define NMAX 1 05 | ^~ componenteconexe1.cpp:13:5: note: in expansion of macro ‘NMAX’ 13 | }cc[NMAX]; | ^~~~ componenteconexe1.cpp:2:17: error: expected ‘]’ before numeric constant 2 | #define NMAX 1 05 | ^~ componenteconexe1.cpp:15:12: note: in expansion of macro ‘NMAX’ 15 | int n, viz[NMAX], nr_comp; | ^~~~ componenteconexe1.cpp:2:17: error: expected ‘]’ before numeric constant 2 | #define NMAX 1 05 | ^~ componenteconexe1.cpp:16:7: note: in expansion of macro ‘NMAX’ 16 | int a[NMAX][NMAX]; | ^~~~ componenteconexe1.cpp:2:17: error: expected ‘]’ before numeric constant 2 | #define NMAX 1 05 | ^~ componenteconexe1.cpp:18:9: note: in expansion of macro ‘NMAX’ 18 | int rad[NMAX]; | ^~~~ componenteconexe1.cpp: In function ‘int main()’: componenteconexe1.cpp:26:14: error: ‘viz’ was not declared in this scope 26 | if (!viz[i]) { | ^~~ componenteconexe1.cpp:27:13: error: ‘nr_comp’ was not declared in this scope 27 | nr_comp++; | ^~~~~~~ componenteconexe1.cpp:28:13: error: ‘rad’ was not declared in this scope; did you mean ‘rand’? 28 | rad[nr_comp] = i; | ^~~ | rand componenteconexe1.cpp:32:12: error: ‘nr_comp’ was not declared in this scope 32 | out << nr_comp - 1<< '\n'; | ^~~~~~~ componenteconexe1.cpp:35:20: error: ‘rad’ was not declared in this scope; did you mean ‘rand’? 35 | out << rad[i] << " " << rad[i + 1] << '\n'; | ^~~ | rand componenteconexe1.cpp:36:13: error: ‘a’ was not declared in this scope 36 | a[rad[i]][rad[i + 1]] = a[rad[i + 1]][rad[i]] = 1; | ^ componenteconexe1.cpp: In function ‘void dfs(int)’: componenteconexe1.cpp:46:5: error: ‘cc’ was not declared in this scope 46 | cc[nr_comp].nr_v++; | ^~ componenteconexe1.cpp:46:8: error: ‘nr_comp’ was not declared in this scope 46 | cc[nr_comp].nr_v++; | ^~~~~~~ componenteconexe1.cpp:48:5: error: ‘viz’ was not declared in this scope 48 | viz[x] = 1; | ^~~ componenteconexe1.cpp:50:24: error: ‘a’ was not declared in this scope 50 | if (!viz[i] && a[x][i]) // i vecin nevizitat al lui x | ^ componenteconexe1.cpp: In function ‘void citire()’: componenteconexe1.cpp:58:9: error: ‘a’ was not declared in this scope 58 | a[x][y] = a[y][x] = 1; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ComponenteConexe1 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ă.