#1887
Dijkstra2
Dijkstra are nevoie de ajutorul vostru pentru a-și duce la bun sfârșit datoria. Acesta vrea să afle drumurile de lungime minimă de la casa prietenului său Vlad la celelalte case ale vecinilor. Nu are foarte mult timp la dispoziție așa ca trebuie să vă mișcați repede. Îl veți ajuta?
Problema | Dijkstra2 | Operații I/O |
dijkstra2.in /dijkstra2.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54873740 | Utilizator | |
Fișier | dijkstra2.cpp | Dimensiune | 1.53 KB |
Data încărcării | 10 Decembrie 2024, 22:40 | Scor / rezultat | Eroare de compilare |
dijkstra2.cpp: In function 'void dijkstra(int, int, const std::vector<std::vector<Edge> >&, std::vector<int>&)': dijkstra2.cpp:17:67: error: wrong number of template arguments (0, should be 1) priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> pq; ^ In file included from /usr/include/c++/4.8/string:48:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from dijkstra2.cpp:1: /usr/include/c++/4.8/bits/stl_function.h:222:12: error: provided for 'template<class _Tp> struct std::greater' struct greater : public binary_function<_Tp, _Tp, bool> ^ dijkstra2.cpp:17:68: error: template argument 3 is invalid priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> pq; ^ dijkstra2.cpp:17:73: error: invalid type in declaration before ';' token priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> pq; ^ dijkstra2.cpp:19:8: error: request for member 'push' in 'pq', which is of non-class type 'int' pq.push({0, start}); ^ dijkstra2.cpp:21:16: error: request for member 'empty' in 'pq', which is of non-class type 'int' while (!pq.empty()) { ^ dijkstra2.cpp:22:14: error: expected unqualified-id before '[' token auto [currentCost, currentNode] = pq.top(); ^ dijkstra2.cpp:23:12: error: request for member 'pop' in 'pq', which is of non-class type 'int' pq.pop(); ^ dijkstra2.cpp:25:13: error: 'currentCost' was not declared in this scope if (currentCost > dist[currentNode]) continue; ^ dijkstra2.cpp:25:32: error: 'currentNode' was not declared in this scope if (currentCost > dist[currentNode]) continue; ^ dijkstra2.cpp:27:39: error: 'currentNode' was not declared in this scope for (const auto& edge : graph[currentNode]) { ^ dijkstra2.cpp:32:20: error: request for member 'push' in 'pq', which is of non-class type 'int' pq.push({dist[neighbor], neighbor}); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Dijkstra2 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ă.