#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 | #63734442 | Utilizator | |
| Fișier | dijkstra.cpp | Dimensiune | 1.25 KB |
| Data încărcării | 17 Martie 2026, 09:44 | Scor/rezultat | Eroare de compilare |
dijkstra.cpp:6:1: error: expected ',' or ';' before 'int' int a[101][101],n,d[101][101],t[101],viz[101]; ^ dijkstra.cpp: In function 'void init()': dijkstra.cpp:10:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ dijkstra.cpp:12:5: error: 'a' was not declared in this scope a[i][j]=inf; ^ dijkstra.cpp: In function 'void citire()': dijkstra.cpp:16:10: error: 'n' was not declared in this scope fin>>n; ^ dijkstra.cpp:20:9: error: 'a' was not declared in this scope a[x][y]=c; ^ dijkstra.cpp:22:17: error: a function-definition is not allowed here before '{' token void drum(int i){ ^ dijkstra.cpp: In function 'int main()': dijkstra.cpp:33:5: error: 'd' was not declared in this scope d[start]=0; ^ dijkstra.cpp:34:5: error: 'viz' was not declared in this scope viz[start]=1; ^ dijkstra.cpp:35:5: error: 't' was not declared in this scope t[start]=0; ^ dijkstra.cpp:36:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++){ ^ dijkstra.cpp:37:14: error: 'a' was not declared in this scope d[i]=a[start][i]; ^ dijkstra.cpp:38:15: error: 'j' was not declared in this scope if(i!=j && a[start][i]!=inf) ^ dijkstra.cpp:42:13: warning: unused variable 'x' [-Wunused-variable] int x; ^ dijkstra.cpp:44:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ dijkstra.cpp:51:13: error: 'x' was not declared in this scope x=i; ^ dijkstra.cpp:54:8: error: 'mini' was not declared in this scope if(mini!=inf) ^ dijkstra.cpp:56:24: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ dijkstra.cpp:58:18: error: 'j' was not declared in this scope if(d[j]=d[x]+a[x][j]) ^ dijkstra.cpp:58:23: error: 'x' was not declared in this scope if(d[j]=d[x]+a[x][j]) ^ dijkstra.cpp:58:26: error: 'a' was not declared in this scope if(d[j]=d[x]+a[x][j]) ^ dijkstra.cpp:65:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ dijkstra.cpp:68:14: error: 'i' was not declared in this scope drum(i); ^ dijkstra.cpp:68:15: error: 'drum' was not declared in this scope drum(i); ^
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ă.