#592
Kruskal
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 | #21631166 | Utilizator | |
Fișier | kruskal.cpp | Dimensiune | 1.10 KB |
Data încărcării | 06 Martie 2020, 21:24 | Scor / rezultat | Eroare de compilare |
kruskal.cpp:6:1: error: expected ',' or ';' before 'ofstream' ofstream fout("kruskal.out") ^ kruskal.cpp:10:1: error: 'v' does not name a type v[5001]; ^ kruskal.cpp:12:17: error: 'muchie' does not name a type bool comp(const muchie & a,const muchie & b) ^ kruskal.cpp:12:26: error: ISO C++ forbids declaration of 'a' with no type [-fpermissive] bool comp(const muchie & a,const muchie & b) ^ kruskal.cpp:12:34: error: 'muchie' does not name a type bool comp(const muchie & a,const muchie & b) ^ kruskal.cpp:12:43: error: ISO C++ forbids declaration of 'b' with no type [-fpermissive] bool comp(const muchie & a,const muchie & b) ^ kruskal.cpp: In function 'bool comp(const int&, const int&)': kruskal.cpp:14:14: error: request for member 'c' in 'a', which is of non-class type 'const int' return a.c<b.c; ^ kruskal.cpp:14:18: error: request for member 'c' in 'b', which is of non-class type 'const int' return a.c<b.c; ^ kruskal.cpp: In function 'void Kruskel()': kruskal.cpp:21:15: error: 'v' was not declared in this scope if(cc[v[i].x]!=cc[v[i].y]) ^ kruskal.cpp:30:25: error: expected ')' before ';' token if(cc[j]==c2;) ^ kruskal.cpp:30:26: error: expected primary-expression before ')' token if(cc[j]==c2;) ^ kruskal.cpp:30:26: error: expected ';' before ')' token kruskal.cpp:26:13: warning: unused variable 'c1' [-Wunused-variable] int c1=min(cc[v[i].x],cc[v[i].y]); ^ kruskal.cpp: In function 'int main()': kruskal.cpp:42:9: error: 'v' was not declared in this scope v[i].x=x; ^ kruskal.cpp:46:10: error: 'v' was not declared in this scope sort(v+1,v+1+m,comp); ^ kruskal.cpp:53:5: error: 'fout' was not declared in this scope fout<<CostTotal<<endl; ^ kruskal.cpp: In function 'bool comp(const int&, const int&)': kruskal.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
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ă.