#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 | #29896596 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 4.36 KB |
Data încărcării | 28 Mai 2021, 17:25 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp:71:11: error: redefinition of 'const int maxn' const int maxn = 5001; // nr maxim de noduri ^ dijkstra.cpp:4:11: error: 'const int maxn' previously defined here const int maxn = 5001; // nr maxim de noduri ^ dijkstra.cpp:72:11: error: redefinition of 'const int inf' const int inf = 1 << 30; //infinit ^ dijkstra.cpp:5:11: error: 'const int inf' previously defined here const int inf = 1 << 30; //infinit ^ dijkstra.cpp:74:13: error: redefinition of 'std::ifstream fin' ifstream fin("dijkstra.in"); ^ dijkstra.cpp:7:10: error: 'std::ifstream fin' previously declared here ifstream fin("dijkstra.in"); ^ dijkstra.cpp:75:14: error: redefinition of 'std::ofstream fout' ofstream fout("dijkstra.out"); ^ dijkstra.cpp:8:10: error: 'std::ofstream fout' previously declared here ofstream fout("dijkstra.out"); ^ dijkstra.cpp:77:5: error: redefinition of 'int n' int n, m; ^ dijkstra.cpp:10:5: error: 'int n' previously declared here int n, m; ^ dijkstra.cpp:77:8: error: redefinition of 'int m' int n, m; ^ dijkstra.cpp:10:8: error: 'int m' previously declared here int n, m; ^ dijkstra.cpp:78:14: error: redefinition of 'int dist [5001]' int dist[maxn]; //costurile de la start la toate nodurile ^ dijkstra.cpp:11:5: error: 'int dist [5001]' previously declared here int dist[maxn]; //costurile de la start la toate nodurile ^ dijkstra.cpp:79:11: error: redefinition of 'int s [5001]' int s[maxn]; // marchez nodurile selectate (nodurile pentru care am gasit deja drumul minim) ^ dijkstra.cpp:12:5: error: 'int s [5001]' previously declared here int s[maxn]; // marchez nodurile selectate (nodurile pentru care am gasit deja drumul minim) ^ dijkstra.cpp:80:11: error: redefinition of 'int t [5001]' int t[maxn]; // predecesorii fiecarui nod i in drumul de la nodul de start ^ dijkstra.cpp:13:5: error: 'int t [5001]' previously declared here int t[maxn]; // predecesorii fiecarui nod i in drumul de la nodul de start ^ dijkstra.cpp:81:19: error: redefinition of 'int mat [5001][5001]' int mat[maxn][maxn]; ^ dijkstra.cpp:14:5: error: 'int mat [5001][5001]' previously declared here int mat[maxn][maxn]; ^ dijkstra.cpp: In function 'void citire()': dijkstra.cpp:83:6: error: redefinition of 'void citire()' void citire() { ^ dijkstra.cpp:16:6: error: 'void citire()' previously defined here void citire() { ^ dijkstra.cpp: In function 'void dijkstra(int)': dijkstra.cpp:95:6: error: redefinition of 'void dijkstra(int)' void dijkstra(int start){ ^ dijkstra.cpp:28:6: error: 'void dijkstra(int)' previously defined here void dijkstra(int start){ ^ dijkstra.cpp: In function 'int main()': dijkstra.cpp:122:5: error: redefinition of 'int main()' int main() { ^ dijkstra.cpp:55:5: error: 'int main()' previously defined here int main() { ^
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ă.