#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 | #64709391 | Utilizator | |
| Fișier | dijkstra.cpp | Dimensiune | 1.17 KB |
| Data încărcării | 25 Mai 2026, 13:06 | Scor/rezultat | Eroare de compilare |
dijkstra.cpp:7:19: error: expected initializer before ‘.’ token 7 | int d[101], s[101]. t[101], minim, poz, max=10000000; | ^ dijkstra.cpp: In function ‘int main()’: dijkstra.cpp:15:26: error: cannot resolve overloaded function ‘max’ based on conversion to type ‘int’ 15 | a[i][j]=max; | ^~~ dijkstra.cpp:10:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 10 | for(int i=1; i<=n; i++) | ^~~ dijkstra.cpp:16:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 16 | while(f>>i>>j>>c) | ^~~~~ dijkstra.cpp:16:15: error: ‘f’ was not declared in this scope 16 | while(f>>i>>j>>c) | ^ dijkstra.cpp:18:9: error: ‘s’ was not declared in this scope 18 | s[p]=1; | ^ dijkstra.cpp:22:26: error: invalid operands of types ‘int’ and ‘<unresolved overloaded function type>’ to binary ‘operator<’ 22 | if(d[i]<max) | ~~~~^~~~ dijkstra.cpp:23:22: error: ‘t’ was not declared in this scope 23 | t[i]=p; | ^ dijkstra.cpp:26:9: error: ‘minim’ was not declared in this scope 26 | minim=max; | ^~~~~ dijkstra.cpp:32:13: error: ‘poz’ was not declared in this scope 32 | poz=j; | ^~~ dijkstra.cpp:34:11: error: ‘poz’ was not declared in this scope 34 | s[poz]=1; | ^~~ dijkstra.cpp:40:13: error: ‘t’ was not declared in this scope 40 | t[j]=poz; | ^ dijkstra.cpp:45:13: error: ‘g’ was not declared in this scope 45 | g<<d[i]<<" "; | ^ dijkstra.cpp:47:9: error: ‘g’ was not declared in this scope 47 | g<<-1<<" "; | ^ dijkstra.cpp:43:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 43 | for(int i=1; i<=n; i++) | ^~~ dijkstra.cpp:48:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 48 | return 0; | ^~~~~~
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ă.