#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 | #42884438 | Utilizator | |
Fișier | componenteconexe.cpp | Dimensiune | 906 B |
Data încărcării | 21 Martie 2023, 12:34 | Scor / rezultat | Eroare de compilare |
componenteconexe.cpp:6:1: error: expected ',' or ';' before 'int' int n,a[10][10],vizitat[20],c[20],prim,nrc,ultim,k,x,y; ^ componenteconexe.cpp: In function 'void citeste()': componenteconexe.cpp:9:8: error: 'n' was not declared in this scope f>>n; ^ componenteconexe.cpp:10:14: error: 'x' was not declared in this scope while(f>>x>>y) ^ componenteconexe.cpp:10:17: error: 'y' was not declared in this scope while(f>>x>>y) ^ componenteconexe.cpp:12:9: error: 'a' was not declared in this scope a[x][y]=a[y][x]=1; ^ componenteconexe.cpp: In function 'void afisare()': componenteconexe.cpp:17:21: error: 'n' was not declared in this scope for(int i=1; i<=n; i++) ^ componenteconexe.cpp:18:16: error: no match for 'operator[]' (operand types are 'std::ofstream {aka std::basic_ofstream<char>}' and 'int') cout<<c[i]<<" "; ^ componenteconexe.cpp: In function 'void bf(int, int)': componenteconexe.cpp:22:5: error: 'vizitat' was not declared in this scope vizitat[x]=val; ^ componenteconexe.cpp:23:21: error: 'n' was not declared in this scope for(int i=1; i<=n; i++) ^ componenteconexe.cpp:24:12: error: 'a' was not declared in this scope if(a[x][i]==1&&vizitat[i]==0) ^ componenteconexe.cpp: In function 'int main()': componenteconexe.cpp:33:21: error: 'n' was not declared in this scope for(int i=1; i<=n; i++) ^ componenteconexe.cpp:34:12: error: 'vizitat' was not declared in this scope if(vizitat[i]==0) ^ componenteconexe.cpp:36:13: error: 'nrc' was not declared in this scope nrc++; ^ componenteconexe.cpp:40:8: error: 'nrc' was not declared in this scope c<<nrc<<endl; ^ componenteconexe.cpp:43:25: error: 'n' was not declared in this scope for(int i=1; i<=n; i++) ^ componenteconexe.cpp:44:16: error: 'vizitat' was not declared in this scope if(vizitat[i]==k) ^
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ă.