#3375
labirint3
Vasilică vizitează cetățile medievale. Fiind curios, el încearcă să descopere pasajele secrete și ascunzătorile. Din nefericire, s-a rătăcit și a ajuns într-o sală din care nu poate ieși decât trecând printr-un labirint. Există o hartă a labirintului, o matrice de n
linii și m
coloane, un element din această matrice reprezentând o cameră. Deplasarea în labirint se poate face numai prin camerele adiacente pe orizontală și verticală. Intrările în labirint sunt notate cu A
, ieșirile cu C
, iar camerele zidite (inaccesibile) cu Z
. Ieșirea din labirint se poate face din una din camerele C, în fiecare astfel de cameră existând câte un elicopter încuiat. Toate elicopterele se deschid cu aceeași cheie, câte un exemplar al cheii aflându-se în camerele B
. Trecerea în altă cameră va dura 1
unitate de timp. Pentru a ieși din labirint Vasilică intră pe una din intrările notate cu A
, ia cheia dintr-o cameră B
și iese din labirint printr-o cameră C
. El va intra în camera A
la timpul 1
. Camerele de tip A
pot fi situate oriunde pe hartă. În drumul de la o cameră de tip A
către o cameră de tip B
se poate trece printr-o cameră de tip C
fără a se ieși din labirint. Ajutați-l pe Vasilică să iasă cât mai repede din labirint.
Olimpiada Municipala de Informatica, Iasi, 2020
Problema | labirint3 | Operații I/O |
labirint.in /labirint.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 32 MB
/
Stivă 10 MB
|
Id soluție | #54167794 | Utilizator | |
Fișier | labirint3.cpp | Dimensiune | 2.28 KB |
Data încărcării | 21 Noiembrie 2024, 10:23 | Scor / rezultat | Eroare de compilare |
labirint3.cpp: In function 'void clear(std::queue<std::pair<int, int> >&)': labirint3.cpp:16:21: error: no matching function for call to 'swap(std::queue<std::pair<int, int> >&, std::queue<int>&)' std::swap( q, empty ); ^ labirint3.cpp:16:21: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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 labirint3.cpp:1: /usr/include/c++/4.8/bits/move.h:166:5: note: template<class _Tp> void std::swap(_Tp&, _Tp&) swap(_Tp& __a, _Tp& __b) ^ /usr/include/c++/4.8/bits/move.h:166:5: note: template argument deduction/substitution failed: labirint3.cpp:16:21: note: deduced conflicting types for parameter '_Tp' ('std::queue<std::pair<int, int> >' and 'std::queue<int>') std::swap( q, empty ); ^ In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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 labirint3.cpp:1: /usr/include/c++/4.8/bits/move.h:185:5: note: template<class _Tp, unsigned int _Nm> void std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm]) swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^ /usr/include/c++/4.8/bits/move.h:185:5: note: template argument deduction/substitution failed: labirint3.cpp:16:21: note: mismatched types '_Tp [_Nm]' and 'std::queue<std::pair<int, int> >' std::swap( q, empty ); ^ 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 labirint3.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template<class _T1, class _T2> void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template argument deduction/substitution failed: labirint3.cpp:16:21: note: 'std::queue<std::pair<int, int> >' is not derived from 'std::pair<_T1, _T2>' std::swap( q, empty ); ^ In file included from /usr/include/c++/4.8/string:52: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 labirint3.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template<class _CharT, class _Traits, class _Alloc> void std::swap(std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&) swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template argument deduction/substitution failed: labirint3.cpp:16:21: note: 'std::queue<std::pair<int, int> >' is not derived from 'std::basic_string<_CharT, _Traits, _Alloc>' std::swap( q, empty ); ^ In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/c++/4.8/queue:60, from labirint3.cpp:3: /usr/include/c++/4.8/bits/stl_deque.h:2011:5: note: template<class _Tp, class _Alloc> void std::swap(std::deque<_Tp, _Alloc>&, std::deque<_Tp, _Alloc>&) swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) ^ /usr/include/c++/4.8/bits/stl_deque.h:2011:5: note: template argument deduction/substitution failed: labirint3.cpp:16:21: note: 'std::queue<std::pair<int, int> >' is not derived from 'std::deque<_Tp, _Alloc>' std::swap( q, empty ); ^ In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/queue:61, from labirint3.cpp:3: /usr/include/c++/4.8/bits/stl_vector.h:1452:5: note: template<class _Tp, class _Alloc> void std::swap(std::vector<_Tp, _Alloc>&, std::vector<_Tp, _Alloc>&) swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) ^ /usr/include/c++/4.8/bits/stl_vector.h:1452:5: note: template argument deduction/substitution failed: labirint3.cpp:16:21: note: 'std::queue<std::pair<int, int> >' is not derived from 'std::vector<_Tp, _Alloc>' std::swap( q, empty ); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/queue:61, from labirint3.cpp:3: /usr/include/c++/4.8/bits/stl_bvector.h:112:3: note: void std::swap(std::_Bit_reference, std::_Bit_reference) swap(_Bit_reference __x, _Bit_reference __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:112:3: note: no known conversion for argument 1 from 'std::queue<std::pair<int, int> >' to 'std::_Bit_reference' /usr/include/c++/4.8/bits/stl_bvector.h:120:3: note: void std::swap(std::_Bit_reference, bool&) swap(_Bit_reference __x, bool& __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:120:3: note: no known conversion for argument 1 from 'std::queue<std::pair<int, int> >' to 'std::_Bit_reference' /usr/include/c++/4.8/bits/stl_bvector.h:128:3: note: void std::swap(bool&, std::_Bit_reference) swap(bool& __x, _Bit_reference __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:128:3: note: no known conversion for argument 1 from 'std::queue<std::pair<int, int> >' to 'bool&' In file included from /usr/include/c++/4.8/queue:64:0, from labirint3.cpp:3: /usr/include/c++/4.8/bits/stl_queue.h:316:5: note: template<class _Tp, class _Seq> void std::swap(std::queue<_Tp, _Seq>&, std::queue<_Tp, _Seq>&) swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y) ^ /usr/include/c++/4.8/bits/stl_queue.h:316:5: note: template argument deduction/substitution failed: labirint3.cpp:16:21: note: deduced conflicting types for parameter '_Tp' ('std::pair<int, int>' and 'int') std::swap( q, empty ); ^ In file included from /usr/include/c++/4.8/queue:64:0, from labirint3.cpp:3: /usr/include/c++/4.8/bits/stl_queue.h:555:5: note: template<class _Tp, class _Sequence, class _Compare> void std::swap(std::priority_queue<_Tp, _Sequence, _Compare>&, std::priority_queue<_Tp, _Sequence, _Compare>&) swap(priority_queue<_Tp, _Sequence, _Compare>& __x, ^ /usr/include/c++/4.8/bits/stl_queue.h:555:5: note: template argument deduction/substitution failed: labirint3.cpp:16:21: note: 'std::queue<std::pair<int, int> >' is not derived from 'std::priority_queue<_Tp, _Sequence, _Compare>' std::swap( q, empty ); ^ labirint3.cpp: In function 'int lee(int, int, int)': labirint3.cpp:20:15: warning: unused variable 'prim' [-Wunused-variable] long long prim=1,ultim=1,i,j; ^ labirint3.cpp:20:22: warning: unused variable 'ultim' [-Wunused-variable] long long prim=1,ultim=1,i,j; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema labirint3 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ă.