#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 | #54918461 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 1.09 KB |
Data încărcării | 12 Decembrie 2024, 10:15 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp: In function 'void drum(int, int)': dijkstra.cpp:5:11: error: 'p' was not declared in this scope if(x!=p) ^ dijkstra.cpp:6:17: error: 'prec' was not declared in this scope drum(p, prec[x]); ^ dijkstra.cpp: In function 'int main()': dijkstra.cpp:13:5: error: 'fin' was not declared in this scope fin>>p; ^ dijkstra.cpp:14:9: error: 'i' was not declared in this scope for(i=1;i<n;i++) ^ dijkstra.cpp:15:13: error: 'j' was not declared in this scope for(j=i+1;j<=n;j++) ^ dijkstra.cpp:17:16: error: 'x' was not declared in this scope while(fin>>x>>y>>c) ^ dijkstra.cpp:17:19: error: 'y' was not declared in this scope while(fin>>x>>y>>c) ^ dijkstra.cpp:17:22: error: 'c' was not declared in this scope while(fin>>x>>y>>c) ^ dijkstra.cpp:19:9: error: 'i' was not declared in this scope for(i=;i<=n;i++){ ^ dijkstra.cpp:19:11: error: expected primary-expression before ';' token for(i=;i<=n;i++){ ^ dijkstra.cpp:24:5: error: 'nr' was not declared in this scope nr=1; ^ dijkstra.cpp:26:9: error: 'dm' was not declared in this scope dm=INF; ^ dijkstra.cpp:27:13: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ dijkstra.cpp:29:26: error: 'im' was not declared in this scope dm=d[i], im=i; ^ dijkstra.cpp:31:21: error: 'im' was not declared in this scope viz[im]=1, nr++; ^ dijkstra.cpp:32:17: error: 'i' was not declared in this scope for(i=1;i<=n;i++){ ^ dijkstra.cpp:33:41: error: 'im' was not declared in this scope if(viz[i]==0&&d[i]>dm+a[im][i]){ ^ dijkstra.cpp:38:18: error: 'dm' was not declared in this scope }while(nr<n&&dm<INF); ^ dijkstra.cpp:39:9: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ dijkstra.cpp:41:13: error: 'fout' was not declared in this scope fout<<-1<<' '; ^ dijkstra.cpp:43:13: error: 'fout' was not declared in this scope fout<<d[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ă.