#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 | #64467158 | Utilizator | |
| Fișier | kruskal.cpp | Dimensiune | 814 B |
| Data încărcării | 08 Mai 2026, 13:27 | Scor/rezultat | Eroare de compilare |
kruskal.cpp:8:2: error: ‘v’ does not name a type 8 | v[101]; | ^ kruskal.cpp:9:2: error: ‘aux’ does not name a type 9 | aux; | ^~~ kruskal.cpp:10:2: error: expected ‘;’ after struct definition 10 | } | ^ | ; kruskal.cpp: In function ‘int main()’: kruskal.cpp:15:10: error: ‘v’ was not declared in this scope 15 | cin>>v[i].x>>v[i].y>>v[i].c; | ^ kruskal.cpp:18:11: error: ‘v’ was not declared in this scope 18 | if(v[i].c>v[j].c) | ^ kruskal.cpp:19:5: error: ‘aux’ was not declared in this scope 19 | {aux=v[i]; | ^~~ kruskal.cpp:24:7: error: ‘x’ was not declared in this scope 24 | { x=v[i].x; | ^ kruskal.cpp:24:9: error: ‘v’ was not declared in this scope 24 | { x=v[i].x; | ^ kruskal.cpp:25:7: error: ‘y’ was not declared in this scope 25 | y=v[i].y; | ^ kruskal.cpp:27:8: error: ‘cost’ was not declared in this scope; did you mean ‘const’? 27 | {cost=cost+v[i].c; | ^~~~ | const kruskal.cpp:30:23: error: expected ‘)’ before ‘{’ token 30 | if((c[x]>c[x]) | ~ ^ | ) 31 | { mx=c[x]; | ~ kruskal.cpp:30:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 30 | if((c[x]>c[x]) | ^~ kruskal.cpp:35:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 35 | for(j=1;j<=n;j++) | ^ kruskal.cpp:35:18: warning: statement has no effect [-Wunused-value] 35 | for(j=1;j<=n;j++) | ~^~~ kruskal.cpp:35:25: error: expected ‘;’ before ‘)’ token 35 | for(j=1;j<=n;j++) | ^ | ; kruskal.cpp:38:9: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 38 | nr++; | ^~ | n kruskal.cpp:44:11: error: ‘cost’ was not declared in this scope; did you mean ‘const’? 44 | cout<<cost<<endl; | ^~~~ | const
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ă.