#590
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 Prim, determinați un arbore parțial de cost minim, cu rădăcina în vârful 1.
| Problema | Prim | Operații I/O |
prim.in/prim.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63955160 | Utilizator | |
| Fișier | prim.cpp | Dimensiune | 1.11 KB |
| Data încărcării | 30 Martie 2026, 11:23 | Scor/rezultat | Eroare de compilare |
prim.cpp: In function 'int main()': prim.cpp:36:14: error: expected unqualified-id before '[' token auto [cost, node] = Q.top(); ^ prim.cpp:39:15: error: 'node' was not declared in this scope if (V[node]) continue; ^ prim.cpp:40:11: error: 'node' was not declared in this scope V[node] = true; ^ prim.cpp:41:14: error: 'cost' was not declared in this scope S += cost; ^ prim.cpp:43:19: error: expected unqualified-id before '[' token for (auto [w, vec] : G[node]) { ^ prim.cpp:43:19: error: expected ';' before '[' token prim.cpp:43:20: error: 'w' was not declared in this scope for (auto [w, vec] : G[node]) { ^ prim.cpp:43:23: error: 'vec' was not declared in this scope for (auto [w, vec] : G[node]) { ^ prim.cpp: In lambda function: prim.cpp:43:28: error: expected '{' before ':' token for (auto [w, vec] : G[node]) { ^ prim.cpp: In function 'int main()': prim.cpp:43:28: error: expected ';' before ':' token prim.cpp:43:28: error: expected primary-expression before ':' token prim.cpp:43:28: error: expected ')' before ':' token prim.cpp:43:28: error: expected primary-expression before ':' token prim.cpp:43:28: error: expected ';' before ':' token prim.cpp:59:1: error: expected '}' at end of input } ^ prim.cpp:59:1: error: expected '}' at end of input
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Prim 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ă.