#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 | #28548489 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 1.43 KB |
Data încărcării | 09 Martie 2021, 22:10 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp: In function 'void citire()': dijkstra.cpp:15:5: error: reference to 'cin' is ambiguous cin>>n>>m; ^ dijkstra.cpp:9:10: note: candidates are: std::ifstream cin ifstream cin("graf.in"); ^ In file included from dijkstra.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ dijkstra.cpp:24:9: error: reference to 'cin' is ambiguous cin>>x>>y>>c; ^ dijkstra.cpp:9:10: note: candidates are: std::ifstream cin ifstream cin("graf.in"); ^ In file included from dijkstra.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ dijkstra.cpp:28:5: error: reference to 'cin' is ambiguous cin>>start; ^ dijkstra.cpp:9:10: note: candidates are: std::ifstream cin ifstream cin("graf.in"); ^ In file included from dijkstra.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ dijkstra.cpp: In function 'int dijkstra()': dijkstra.cpp:57:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ dijkstra.cpp: In function 'int afis(int)': dijkstra.cpp:64:9: error: reference to 'cout' is ambiguous cout<<x<<" "; ^ dijkstra.cpp:10:10: note: candidates are: std::ofstream cout ofstream cout("graf.out"); ^ In file included from dijkstra.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ dijkstra.cpp:67:9: error: reference to 'cout' is ambiguous cout<<start<<" "; ^ dijkstra.cpp:10:10: note: candidates are: std::ofstream cout ofstream cout("graf.out"); ^ In file included from dijkstra.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ dijkstra.cpp:68:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ dijkstra.cpp: In function 'int main()': dijkstra.cpp:77:13: error: reference to 'cout' is ambiguous cout<<"Drumul de la "<<start<<" la "<<i<<" are cost "<<d[i]<<" : "; ^ dijkstra.cpp:10:10: note: candidates are: std::ofstream cout ofstream cout("graf.out"); ^ In file included from dijkstra.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ dijkstra.cpp:79:13: error: reference to 'cout' is ambiguous cout<<"\n"; ^ dijkstra.cpp:10:10: note: candidates are: std::ofstream cout ofstream cout("graf.out"); ^ In file included from dijkstra.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
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ă.