#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 | #29660659 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 1.01 KB |
Data încărcării | 14 Mai 2021, 11:02 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp: In function 'void djikstra(int)': dijkstra.cpp:19:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i!=v[p].size();++i) ^ dijkstra.cpp:30:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i!=v[pn].size();++i) ^ dijkstra.cpp: In function 'int main()': dijkstra.cpp:38:5: error: reference to 'cin' is ambiguous cin>>n>>p; ^ dijkstra.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("dijkstra.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from dijkstra.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ dijkstra.cpp:42:15: error: reference to 'cin' is ambiguous while(cin>>x>>y>>z) ^ dijkstra.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("dijkstra.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from dijkstra.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ dijkstra.cpp:47:9: error: reference to 'cout' is ambiguous cout<<d[i]<<" "; ^ dijkstra.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("dijkstra.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from dijkstra.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ dijkstra.cpp:49:9: error: reference to 'cout' is ambiguous cout<<"-1 "; ^ dijkstra.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("dijkstra.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from dijkstra.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ dijkstra.cpp:50:5: error: 're' was not declared in this scope re ^ dijkstra.cpp:50:5: error: expected ';' at end of input dijkstra.cpp:37:11: warning: unused variable 'm' [-Wunused-variable] { int p,m; ^ dijkstra.cpp:50:5: error: expected '}' at end of input re ^
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ă.