#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 | #58010095 | Utilizator | |
Fișier | prim.cpp | Dimensiune | 1.10 KB |
Data încărcării | 08 Mai 2025, 08:54 | Scor / rezultat | Eroare de compilare |
prim.cpp:3:11: error: variable 'std::ifstream f' has initializer but incomplete type ifstream f("prim.in"); ^ prim.cpp:4:11: error: variable 'std::ofstream g' has initializer but incomplete type ofstream g("prim.out"); ^ prim.cpp:5:1: error: 'vector' does not name a type vector <pair<int , int>> G[101]; ^ prim.cpp:7:1: error: 'vector' does not name a type vector<int> T,D; ^ prim.cpp:8:1: error: 'vector' does not name a type vector<bool>V; ^ prim.cpp: In function 'int main()': prim.cpp:14:9: error: 'G' was not declared in this scope G[x].push_back({c , y}); ^ prim.cpp:17:5: error: 'priority_queue' was not declared in this scope priority_queue < ^ prim.cpp:18:22: error: expected primary-expression before ',' token pair<int,int>, ^ prim.cpp:19:9: error: 'vector' was not declared in this scope vector<pair<int,int>>, ^ prim.cpp:19:28: error: expected primary-expression before '>' token vector<pair<int,int>>, ^ prim.cpp:19:30: error: expected primary-expression before ',' token vector<pair<int,int>>, ^ prim.cpp:21:5: error: expected primary-expression before '>' token >Q; ^ prim.cpp:21:6: error: 'Q' was not declared in this scope >Q; ^ prim.cpp:22:5: error: 'V' was not declared in this scope V.resize(n+1,false); ^ prim.cpp:23:5: error: 'T' was not declared in this scope T.resize(n+1,-1); ^ prim.cpp:24:5: error: 'D' was not declared in this scope D.resize(n+1,0x3f3f3f3f); ^ prim.cpp:28:16: error: 'G' was not declared in this scope for(auto x:G[1]) ^ prim.cpp:43:20: error: 'G' was not declared in this scope for(auto x:G[P.second]) ^
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ă.