#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 | #53602471 | Utilizator | |
Fișier | dijkstra.cpp | Dimensiune | 1.32 KB |
Data încărcării | 06 Noiembrie 2024, 10:52 | Scor / rezultat | Eroare de compilare |
dijkstra.cpp: In function 'void citire()': dijkstra.cpp:21:9: error: 'v' was not declared in this scope v[x].push_back(make_pair(y, c)); // try replacing this with normal constructor ^ dijkstra.cpp: In function 'void init()': dijkstra.cpp:28:9: error: 'sf' was not declared in this scope sf[i] = 0; ^ dijkstra.cpp:30:18: error: 'v' was not declared in this scope for(auto &i: v[p]) d[i.first] = i.second; ^ dijkstra.cpp:32:5: error: 'sf' was not declared in this scope sf[p] = 1; ^ dijkstra.cpp: In function 'void dijkstra(int)': dijkstra.cpp:36:12: error: 'deverif' was not declared in this scope while(!deverif.empty()){ ^ dijkstra.cpp:38:16: error: request for member 'second' in 'curr', which is of non-class type 'int' d[curr.second.second] = d[curr.second.first] + ax[curr.second.first][curr.second.seconbd]; ^ dijkstra.cpp:38:40: error: request for member 'second' in 'curr', which is of non-class type 'int' d[curr.second.second] = d[curr.second.first] + ax[curr.second.first][curr.second.seconbd]; ^ dijkstra.cpp:38:64: error: request for member 'second' in 'curr', which is of non-class type 'int' d[curr.second.second] = d[curr.second.first] + ax[curr.second.first][curr.second.seconbd]; ^ dijkstra.cpp:38:83: error: request for member 'second' in 'curr', which is of non-class type 'int' d[curr.second.second] = d[curr.second.first] + ax[curr.second.first][curr.second.seconbd]; ^ dijkstra.cpp:39:22: error: 'v' was not declared in this scope for(auto &i: v[curr.second.second]){ ^ dijkstra.cpp:39:29: error: request for member 'second' in 'curr', which is of non-class type 'int' for(auto &i: v[curr.second.second]){ ^ dijkstra.cpp:40:28: error: request for member 'second' in 'curr', which is of non-class type 'int' if(d[i]>d[curr.second.second]+ax[curr.second.first][curr.second.second]){ ^ dijkstra.cpp:40:51: error: request for member 'second' in 'curr', which is of non-class type 'int' if(d[i]>d[curr.second.second]+ax[curr.second.first][curr.second.second]){ ^ dijkstra.cpp:40:70: error: request for member 'second' in 'curr', which is of non-class type 'int' if(d[i]>d[curr.second.second]+ax[curr.second.first][curr.second.second]){ ^ dijkstra.cpp:41:43: error: expected primary-expression before ',' token deverif.insert(make_pair( , make_pair())) ^ dijkstra.cpp:41:55: error: no matching function for call to 'make_pair()' deverif.insert(make_pair( , make_pair())) ^ dijkstra.cpp:41:55: note: candidate is: In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from dijkstra.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:276:5: note: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) make_pair(_T1&& __x, _T2&& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:276:5: note: template argument deduction/substitution failed: dijkstra.cpp:41:55: note: candidate expects 2 arguments, 0 provided deverif.insert(make_pair( , make_pair())) ^ dijkstra.cpp:42:13: error: expected ';' before '}' token } ^ dijkstra.cpp: In function 'void afisare()': dijkstra.cpp:50:12: error: 'a' was not declared in this scope if(a[i] || i==p) fout<<a[i]<<' '; ^
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ă.