#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 | #50118000 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 987 B |
Data încărcării | 27 Martie 2024, 17:05 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp: In function 'void citire()': dijkstra.cpp:4:5: error: 'fin' was not declared in this scope fin>>n>>m; ^ dijkstra.cpp:4:10: error: 'n' was not declared in this scope fin>>n>>m; ^ dijkstra.cpp:8:17: error: 'a' was not declared in this scope a[i][j]=0; ^ dijkstra.cpp:10:17: error: 'a' was not declared in this scope a[i][j]=inf; ^ dijkstra.cpp:10:25: error: 'inf' was not declared in this scope a[i][j]=inf; ^ dijkstra.cpp:14:9: error: 'a' was not declared in this scope a[x][y]=c; ^ dijkstra.cpp:17:10: error: 'p' was not declared in this scope fin>>p; ^ dijkstra.cpp: In function 'int dijkstra()': dijkstra.cpp:22:16: error: 'n' was not declared in this scope for (i=1;i<n;i++) ^ dijkstra.cpp:24:9: error: 'd' was not declared in this scope d[i]=a[p][i]; ^ dijkstra.cpp:24:14: error: 'a' was not declared in this scope d[i]=a[p][i]; ^ dijkstra.cpp:24:16: error: 'p' was not declared in this scope d[i]=a[p][i]; ^ dijkstra.cpp:25:9: error: 's' was not declared in this scope s[i]=0; ^ dijkstra.cpp:26:19: error: 'inf' was not declared in this scope if (d[i]!=inf && d[i]!=0) ^ dijkstra.cpp:27:13: error: 't' was not declared in this scope t[i]=p; ^ dijkstra.cpp:29:5: error: 's' was not declared in this scope s[p]=1; ^ dijkstra.cpp:29:7: error: 'p' was not declared in this scope s[p]=1; ^ dijkstra.cpp:30:16: error: 'n' was not declared in this scope for (i=1;i<n;i++) ^ dijkstra.cpp:32:12: error: 'inf' was not declared in this scope mn=inf; ^ dijkstra.cpp:34:28: error: 'd' was not declared in this scope if (s[j]==0 && d[j]<mn) ^ dijkstra.cpp:40:17: error: 'd' was not declared in this scope if (d[x]+a[x][j]<d[j]) ^ dijkstra.cpp:40:22: error: 'a' was not declared in this scope if (d[x]+a[x][j]<d[j]) ^ dijkstra.cpp:43:17: error: 't' was not declared in this scope t[j]=x; ^ dijkstra.cpp:46:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ dijkstra.cpp: In function 'int afis(int)': dijkstra.cpp:50:12: error: 'p' was not declared in this scope if (x!=p) ^ dijkstra.cpp:52:14: error: 't' was not declared in this scope afis(t[x]); ^ dijkstra.cpp:53:9: error: 'cout' was not declared in this scope cout<<x<<" "; ^ dijkstra.cpp:56:9: error: 'cout' was not declared in this scope cout<<p<<" "; ^ dijkstra.cpp:57:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^
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ă.