#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 | #50050203 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 2.15 KB |
Data încărcării | 25 Martie 2024, 14:48 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp:57:11: error: redefinition of 'std::ifstream f' ifstream f("dijkstra.in"); ^ dijkstra.cpp:5:10: error: 'std::ifstream f' previously declared here ifstream f("dijkstra.in"); ^ dijkstra.cpp:58:11: error: redefinition of 'std::ofstream g' ofstream g("dijkstra.out"); ^ dijkstra.cpp:6:10: error: 'std::ofstream g' previously declared here ofstream g("dijkstra.out"); ^ dijkstra.cpp:59:10: error: conflicting declaration 'int d [101]' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:5: error: 'd' has a previous declaration as 'int d [1001]' int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:22: error: conflicting declaration 'int a [101][101]' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:13: error: 'a' has a previous declaration as 'int a [1001][1001]' int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:24: error: redefinition of 'int i' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:27: error: 'int i' previously declared here int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:26: error: redefinition of 'int n' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:29: error: 'int n' previously declared here int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:28: error: redefinition of 'int s' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:31: error: 'int s' previously declared here int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:30: error: redefinition of 'int c' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:33: error: 'int c' previously declared here int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:39: error: conflicting declaration 'int sel [101]' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:35: error: 'sel' has a previous declaration as 'int sel [1001]' int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:41: error: redefinition of 'int x' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:45: error: 'int x' previously declared here int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:43: error: redefinition of 'int y' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:47: error: 'int y' previously declared here int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp:59:45: error: redefinition of 'int j' int d[101],a[101][101],i,n,s,c,sel[101],x,y,j; ^ dijkstra.cpp:7:49: error: 'int j' previously declared here int d[1001],a[1001][1001],i,n,s,c,sel[1001],x,y,j; ^ dijkstra.cpp: In function 'void dijkstra(int)': dijkstra.cpp:60:6: error: redefinition of 'void dijkstra(int)' void dijkstra(int s) ^ dijkstra.cpp:8:6: error: 'void dijkstra(int)' previously defined here void dijkstra(int s) ^ dijkstra.cpp: In function 'int main()': dijkstra.cpp:88:5: error: redefinition of 'int main()' int main() ^ dijkstra.cpp:36: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ă.