#1887
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 | #62709066 | Utilizator | |
| Fișier | dijkstra2.cpp | Dimensiune | 1.03 KB |
| Data încărcării | 30 Ianuarie 2026, 10:41 | Scor/rezultat | Eroare de compilare |
dijkstra2.cpp: In function 'int main()': dijkstra2.cpp:23:77: error: wrong number of template arguments (0, should be 1) priority_queue<pair<long long,int>, vector<pair<long long,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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, 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:23:78: error: template argument 3 is invalid priority_queue<pair<long long,int>, vector<pair<long long,int>>, greater<>> pq; ^ dijkstra2.cpp:23:83: error: invalid type in declaration before ';' token priority_queue<pair<long long,int>, vector<pair<long long,int>>, greater<>> pq; ^ dijkstra2.cpp:24:8: error: request for member 'push' in 'pq', which is of non-class type 'int' pq.push({0, p}); ^ dijkstra2.cpp:26:15: error: request for member 'empty' in 'pq', which is of non-class type 'int' while(!pq.empty()) { ^ dijkstra2.cpp:27:14: error: expected unqualified-id before '[' token auto [dist, u] = pq.top(); pq.pop(); ^ dijkstra2.cpp:27:39: error: request for member 'pop' in 'pq', which is of non-class type 'int' auto [dist, u] = pq.top(); pq.pop(); ^ dijkstra2.cpp:28:12: error: 'dist' was not declared in this scope if(dist > d[u]) continue; // ignorăm vechile valori ^ dijkstra2.cpp:28:21: error: 'u' was not declared in this scope if(dist > d[u]) continue; // ignorăm vechile valori ^ dijkstra2.cpp:29:19: error: expected unqualified-id before '[' token for(auto &[v, w] : adj[u]) { ^ dijkstra2.cpp:29:19: error: expected ';' before '[' token dijkstra2.cpp:29:20: error: 'v' was not declared in this scope for(auto &[v, w] : adj[u]) { ^ dijkstra2.cpp:29:23: error: 'w' was not declared in this scope for(auto &[v, w] : adj[u]) { ^ dijkstra2.cpp: In lambda function: dijkstra2.cpp:29:26: error: expected '{' before ':' token for(auto &[v, w] : adj[u]) { ^ dijkstra2.cpp: In function 'int main()': dijkstra2.cpp:29:26: error: expected ';' before ':' token dijkstra2.cpp:29:26: error: expected primary-expression before ':' token dijkstra2.cpp:29:26: error: expected ')' before ':' token dijkstra2.cpp:29:26: error: expected primary-expression before ':' token dijkstra2.cpp:29:26: error: expected ';' before ':' token dijkstra2.cpp:44:1: error: expected '}' at end of input } ^ dijkstra2.cpp:44:1: error: expected '}' at end of input
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ă.