#592
Se dă un graf neorientat ponderat conex cu n
vârfuri și m
muchii – în care fiecare muchie are asociat un cost, număr natural strict pozitiv. Folosind algoritmul lui Kruskal, determinați un arbore parțial de cost minim.
Problema | Kruskal | Operații I/O |
![]() kruskal.in /kruskal.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #56800843 | Utilizator | |
Fișier | kruskal.cpp | Dimensiune | 1.61 KB |
Data încărcării | 06 Martie 2025, 10:23 | Scor / rezultat | Eroare de compilare |
kruskal.cpp:19:33: error: 'n' has not been declared void ordonare (muchie v[5000], n) ^ kruskal.cpp: In function 'void ordonare(muchie*, int)': kruskal.cpp:22:21: error: 'm' was not declared in this scope for(int i=1;i<=m;i++) ^ kruskal.cpp:26:20: error: cannot convert 'muchie' to 'int' in assignment aux=v[i]; ^ kruskal.cpp:28:21: error: no match for 'operator=' (operand types are 'muchie' and 'int') v[j]=aux; ^ kruskal.cpp:28:21: note: candidates are: kruskal.cpp:7:8: note: muchie& muchie::operator=(const muchie&) struct muchie{ ^ kruskal.cpp:7:8: note: no known conversion for argument 1 from 'int' to 'const muchie&' kruskal.cpp:7:8: note: muchie& muchie::operator=(muchie&&) kruskal.cpp:7:8: note: no known conversion for argument 1 from 'int' to 'muchie&&' kruskal.cpp:21:10: warning: unused variable 'i' [-Wunused-variable] int i,j,aux; ^ kruskal.cpp:21:12: warning: unused variable 'j' [-Wunused-variable] int i,j,aux; ^ kruskal.cpp: In function 'void APCM(muchie*, int)': kruskal.cpp:34:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ///s au sters toate muchiile si obtin n componente conexe ^ kruskal.cpp:45:24: error: 'n' was not declared in this scope for(j=1;j<=n;j++) ^ kruskal.cpp: In function 'int main()': kruskal.cpp:54:10: error: 'n' was not declared in this scope fin>>n>>m; ^ kruskal.cpp:54:13: error: 'm' was not declared in this scope fin>>n>>m; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Kruskal 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ă.