#4078
Distanta
Matei, care locuiește in orașul p
, vrea să ajungă in orașul q
să il viziteze. El are o hartă pe care se află n
orașe și m
drumuri prin care poate să treacă pentru a ajunge la destinație. Pe hartă apare și durata de timp td
pentru fiecare drum, care reprezintă numărul de minute în care este parcurs drumul și to
pentru traversarea orașelor (unele orașe sunt mai aglomerate, iar altele nu). Matei vrea să ajungă cat mai rapid la destinație, dar dacă există mai multe trasee de timp minim, il va alege pe acela care trece prin mai multe orașe. Nu vor exista trasee de timp minim cu același număr de orașe. Ajutati-l pe Matei să gasească drumul cerut.
Problema | Distanta | Operații I/O |
![]() distanta.in /distanta.out
|
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51303244 | Utilizator | |
Fișier | distanta.cpp | Dimensiune | 2.22 KB |
Data încărcării | 05 Iunie 2024, 18:08 | Scor / rezultat | Eroare de compilare |
distanta.cpp: In function 'void bfs(int)': distanta.cpp:69:26: error: no matching function for call to 'begin(std::pair<int, int>&)' for(auto j : i) ^ distanta.cpp:69:26: note: candidates are: In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0, from /usr/include/c++/4.8/string:52, 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/fstream:38, from distanta.cpp:1: /usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>) begin(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed: distanta.cpp:69:26: note: 'std::pair<int, int>' is not derived from 'std::initializer_list<_Tp>' for(auto j : i) ^ In file included from /usr/include/c++/4.8/string:51: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/fstream:38, from distanta.cpp:1: /usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm]) begin(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed: distanta.cpp:69:26: note: mismatched types '_Tp [_Nm]' and 'std::pair<int, int>' for(auto j : i) ^ In file included from /usr/include/c++/4.8/string:51: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/fstream:38, from distanta.cpp:1: /usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) begin(const _Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = std::pair<int, int>]': distanta.cpp:69:26: required from here /usr/include/c++/4.8/bits/range_access.h:58:5: error: 'const struct std::pair<int, int>' has no member named 'begin' /usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&) begin(_Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = std::pair<int, int>]': distanta.cpp:69:26: required from here /usr/include/c++/4.8/bits/range_access.h:48:5: error: 'struct std::pair<int, int>' has no member named 'begin' distanta.cpp:69:26: error: no matching function for call to 'end(std::pair<int, int>&)' for(auto j : i) ^ distanta.cpp:69:26: note: candidates are: In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0, from /usr/include/c++/4.8/string:52, 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/fstream:38, from distanta.cpp:1: /usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>) end(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed: distanta.cpp:69:26: note: 'std::pair<int, int>' is not derived from 'std::initializer_list<_Tp>' for(auto j : i) ^ In file included from /usr/include/c++/4.8/string:51: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/fstream:38, from distanta.cpp:1: /usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm]) end(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed: distanta.cpp:69:26: note: mismatched types '_Tp [_Nm]' and 'std::pair<int, int>' for(auto j : i) ^ In file included from /usr/include/c++/4.8/string:51: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/fstream:38, from distanta.cpp:1: /usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&) end(const _Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = std::pair<int, int>]': distanta.cpp:69:26: required from here /usr/include/c++/4.8/bits/range_access.h:78:5: error: 'const struct std::pair<int, int>' has no member named 'end' /usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&) end(_Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = std::pair<int, int>]': distanta.cpp:69:26: required from here /usr/include/c++/4.8/bits/range_access.h:68:5: error: 'struct std::pair<int, int>' has no member named 'end' distanta.cpp: In function 'int decodif(std::string)': distanta.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ distanta.cpp: In function 'int costnod(int)': distanta.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ distanta.cpp: In function 'std::string afisnod(int)': distanta.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Distanta 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ă.