#4916
Sezonul 5, episodul 1: Sigismund Dijkstra a închis-o pe Ciri în castelul din vârful muntelui și Geralt trebuie să o salveze.
Harta muntelui este reprezentată printr-o matrice cu n linii și m coloane în care fiecare element reprezintă înălțimea zonei respective. Castelul se află în cel mai înalt vîrf al muntelui. Geralt pleacă de la coordonatele (1,1) și trebuie să ajungă la coordonatele vârfului într-un timp cât mai scurt, de aceea se deplasează pe aceeași linie sau coloană, fără a trece de două ori prin aceeași zonă și poate să treacă din zona curentă în zona învecinată numai dacă înălțimea zonei curente este mai mică sau egală cu cea a zonei învecinate.
Determinați numărul de trasee pe care poate Geralt să o salveze pe Ciri.
| Problema | The Witcher | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64915602 | Utilizator | |
| Fișier | the_witcher.cpp | Dimensiune | 2.18 KB |
| Data încărcării | 12 Iunie 2026, 15:33 | Scor/rezultat | Eroare de compilare |
the_witcher.cpp: In function ‘int bfs(int (*)[20], std::vector<std::vector<bool> >, int&, int&, int&, int&)’: the_witcher.cpp:14:11: error: no matching function for call to ‘std::queue<std::tuple<int, int, int> >::push(<brace-enclosed initializer list>)’ 14 | q.push({0, 0, 0}); | ~~~~~~^~~~~~~~~~~ In file included from /usr/include/c++/13/queue:66, from the_witcher.cpp:3: /usr/include/c++/13/bits/stl_queue.h:285:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; value_type = std::tuple<int, int, int>]’ 285 | push(const value_type& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:285:30: note: no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const std::queue<std::tuple<int, int, int> >::value_type&’ {aka ‘const std::tuple<int, int, int>&’} 285 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_queue.h:290:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; value_type = std::tuple<int, int, int>]’ 290 | push(value_type&& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:290:25: note: no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘std::queue<std::tuple<int, int, int> >::value_type&&’ {aka ‘std::tuple<int, int, int>&&’} 290 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ the_witcher.cpp:19:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 19 | auto [py, px, num] = q.front(); | ^ the_witcher.cpp:19:14: error: deduced type ‘std::tuple<int, int, int>’ for ‘<structured bindings>’ is incomplete 19 | auto [py, px, num] = q.front(); | ^~~~~~~~~~~~~ In file included from /usr/include/c++/13/bits/stl_algobase.h:64, from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from the_witcher.cpp:1: /usr/include/c++/13/bits/stl_pair.h:90:11: note: declaration of ‘class std::tuple<int, int, int>’ 90 | class tuple; | ^~~~~ the_witcher.cpp:30:41: error: ‘posx’ was not declared in this scope; did you mean ‘posy’? 30 | if(posy >= 0 && posy < n && posx >= 0 && posx < m && grid[py][px] <= grid[posy][posx] && !visited[posy][posx]){ | ^~~~ | posy the_witcher.cpp:32:23: error: no matching function for call to ‘std::queue<std::tuple<int, int, int> >::push(<brace-enclosed initializer list>)’ 32 | q.push({posy, posx, num + 1}); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/stl_queue.h:285:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; value_type = std::tuple<int, int, int>]’ 285 | push(const value_type& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:285:30: note: no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const std::queue<std::tuple<int, int, int> >::value_type&’ {aka ‘const std::tuple<int, int, int>&’} 285 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_queue.h:290:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; value_type = std::tuple<int, int, int>]’ 290 | push(value_type&& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:290:25: note: no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘std::queue<std::tuple<int, int, int> >::value_type&&’ {aka ‘std::tuple<int, int, int>&&’} 290 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/13/deque:66, from /usr/include/c++/13/queue:62: /usr/include/c++/13/bits/stl_deque.h: In instantiation of ‘void std::deque<_Tp, _Alloc>::_M_destroy_data(iterator, iterator, const std::allocator<_CharT>&) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; iterator = std::_Deque_base<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >::iterator]’: /usr/include/c++/13/bits/stl_deque.h:1028:24: required from ‘std::deque<_Tp, _Alloc>::~deque() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]’ /usr/include/c++/13/bits/stl_queue.h:96:11: required from here /usr/include/c++/13/bits/stl_deque.h:2090:14: error: invalid use of incomplete type ‘std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >::value_type’ {aka ‘class std::tuple<int, int, int>’} [-fpermissive] 2090 | if (!__has_trivial_destructor(value_type)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/stl_pair.h:90:11: note: declaration of ‘std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >::value_type’ {aka ‘class std::tuple<int, int, int>’} 90 | class tuple; | ^~~~~ /usr/include/c++/13/bits/stl_deque.h: In instantiation of ‘void std::deque<_Tp, _Alloc>::pop_front() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]’: /usr/include/c++/13/bits/stl_queue.h:321:13: required from ‘void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >]’ the_witcher.cpp:20:14: required from here /usr/include/c++/13/bits/stl_deque.h:1578:47: error: invalid use of incomplete type ‘class std::tuple<int, int, int>’ 1578 | != this->_M_impl._M_start._M_last - 1) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_pair.h:90:11: note: declaration of ‘class std::tuple<int, int, int>’ 90 | class tuple; | ^~~~~ /usr/include/c++/13/bits/stl_deque.h:1582:38: error: cannot increment a pointer to incomplete type ‘std::tuple<int, int, int>’ 1582 | ++this->_M_impl._M_start._M_cur; | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ /usr/include/c++/13/bits/stl_deque.h: In instantiation of ‘void std::_Deque_base<_Tp, _Alloc>::_M_initialize_map(std::size_t) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::size_t = long unsigned int]’: /usr/include/c++/13/bits/stl_deque.h:460:9: required from ‘std::_Deque_base<_Tp, _Alloc>::_Deque_base() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]’ /usr/include/c++/13/bits/stl_deque.h:855:7: required from ‘std::queue<_Tp, _Sequence>::queue() [with _Seq = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; _Requires = void; _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >]’ the_witcher.cpp:10:33: required from here /usr/include/c++/13/bits/stl_deque.h:641:69: error: invalid application of ‘sizeof’ to incomplete type ‘std::tuple<int, int, int>’ 641 | const size_t __num_nodes = (__num_elements / __deque_buf_size(sizeof(_Tp)) | ^~~~~~~~~~~ /usr/include/c++/13/bits/stl_deque.h:672:60: error: invalid application of ‘sizeof’ to incomplete type ‘std::tuple<int, int, int>’ 672 | % __deque_buf_size(sizeof(_Tp))); | ^~~~~~~~~~~ /usr/include/c++/13/bits/stl_deque.h: In instantiation of ‘void std::_Deque_base<_Tp, _Alloc>::_M_deallocate_node(_Ptr) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; _Ptr = std::tuple<int, int, int>*]’: /usr/include/c++/13/bits/stl_deque.h:700:2: required from ‘void std::_Deque_base<_Tp, _Alloc>::_M_destroy_nodes(_Map_pointer, _Map_pointer) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; _Map_pointer = std::tuple<int, int, int>**]’ /usr/include/c++/13/bits/stl_deque.h:622:4: required from ‘std::_Deque_base<_Tp, _Alloc>::~_Deque_base() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]’ /usr/include/c++/13/bits/stl_deque.h:855:7: required from ‘std::queue<_Tp, _Sequence>::queue() [with _Seq = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; _Requires = void; _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >]’ the_witcher.cpp:10:33: required from here /usr/include/c++/13/bits/stl_deque.h:590:60: error: invalid application of ‘sizeof’ to incomplete type ‘std::tuple<int, int, int>’ 590 | _Traits::deallocate(_M_impl, __p, __deque_buf_size(sizeof(_Tp))); | ^~~~~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema The Witcher 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ă.