#588
Dijkstra
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 | #8573558 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 994 B |
Data încărcării | 01 Martie 2018, 13:43 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp: In function 'void initc()': dijkstra.cpp:8:5: error: 'f' was not declared in this scope f>>n; ^ dijkstra.cpp:8:8: error: 'n' was not declared in this scope f>>n; ^ dijkstra.cpp:9:9: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ dijkstra.cpp:10:13: error: 'j' was not declared in this scope for(j=1;j<=n;j++) ^ dijkstra.cpp:13:20: error: 'z' was not declared in this scope while(f>>x>>y>>z) c[x][y]=z; ^ dijkstra.cpp:13:26: error: invalid types 'int[int]' for array subscript while(f>>x>>y>>z) c[x][y]=z; ^ dijkstra.cpp: In function 'void dijkstra()': dijkstra.cpp:19:16: error: 'n' was not declared in this scope for(i=1;i<=n;i++) d[i]=inf; ^ dijkstra.cpp:20:7: error: 's' was not declared in this scope d[s]=0; ^ dijkstra.cpp:21:9: error: 'k' was not declared in this scope for(k=1;k<=n;k++) ^ dijkstra.cpp:21:16: error: 'n' was not declared in this scope for(k=1;k<=n;k++) ^ dijkstra.cpp:24:13: error: 'j' was not declared in this scope for(j=1;j<=n;j++) ^ dijkstra.cpp:28:13: error: 'x' was not declared in this scope x=j; ^ dijkstra.cpp:31:9: error: 'x' was not declared in this scope use[x]=1; ^ dijkstra.cpp:32:9: error: 'j' was not declared in this scope for(j=1;j<=n;j++) ^ dijkstra.cpp: In function 'int main()': dijkstra.cpp:46:9: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ dijkstra.cpp:46:16: error: 'n' was not declared in this scope for(i=1;i<=n;i++) ^ dijkstra.cpp:47:15: error: 's' was not declared in this scope if(i!=s) ^ dijkstra.cpp:47:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(i!=s) ^
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ă.