#588
Se dă un graf orientat ponderat – în care fiecare arc are asociat un cost, număr natural strict pozitiv, și un nod p
. Să se determine, folosind algoritmul lui Dijkstra, costul minim al drumului de la p
la fiecare nod al grafului.
Problema | Dijkstra | Operații I/O |
![]() dijkstra.in /dijkstra.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57058329 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 1.21 KB |
Data încărcării | 14 Martie 2025, 10:53 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp: In function 'void dijkstra(int)': dijkstra.cpp:27:13: error: expected unqualified-id before '[' token auto[nod,dist]=q.top(); ^ dijkstra.cpp:29:12: error: 'dist' was not declared in this scope if(dist>cost[nod]) ^ dijkstra.cpp:29:22: error: 'nod' was not declared in this scope if(dist>cost[nod]) ^ dijkstra.cpp:31:19: error: expected unqualified-id before '[' token for( auto [nxt,new_dist] : graf[nod]){ ^ dijkstra.cpp:31:19: error: expected ';' before '[' token dijkstra.cpp:31:20: error: 'nxt' was not declared in this scope for( auto [nxt,new_dist] : graf[nod]){ ^ dijkstra.cpp:31:24: error: 'new_dist' was not declared in this scope for( auto [nxt,new_dist] : graf[nod]){ ^ dijkstra.cpp: In lambda function: dijkstra.cpp:31:34: error: expected '{' before ':' token for( auto [nxt,new_dist] : graf[nod]){ ^ dijkstra.cpp: In function 'void dijkstra(int)': dijkstra.cpp:31:34: error: expected ';' before ':' token dijkstra.cpp:31:34: error: expected primary-expression before ':' token dijkstra.cpp:31:34: error: expected ')' before ':' token dijkstra.cpp:31:34: error: expected primary-expression before ':' token dijkstra.cpp:31:34: error: expected ';' before ':' token dijkstra.cpp:62:1: error: expected '}' at end of input } ^ dijkstra.cpp:62:1: error: expected '}' at end of input
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Dijkstra 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ă.