#4806
EscapeLight
Andrei se află într-un labirint format dintr-o matrice de camere, fiecare având unul dintre următoarele tipuri: 0
: cameră cu bec stins, 1
: cameră cu bec aprins, 2
: cameră fără bec (inaccesibilă), 3
: cameră cu întrerupător.
Camerele de tip 3
pot aprinde/stinge becurile altor camere. Andrei poate alege să apese sau nu întrerupătoarele întâlnite. El pornește dintr-o cameră dată și trebuie să ajungă într-o cameră destinație, deplasându-se doar prin camere aprinse.
Se cere determinarea distanței minime pentru a ajunge la destinație.
Concursul Național de Matematică și Informatică Grigore Moisil
Problema | EscapeLight | Operații I/O |
![]() escapelight.in /escapelight.out
|
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58500516 | Utilizator | |
Fișier | escapelight.cpp | Dimensiune | 4.54 KB |
Data încărcării | 11 Iunie 2025, 20:27 | Scor / rezultat | Eroare de compilare |
escapelight.cpp: In function 'int main()': escapelight.cpp:110:53: error: converting to 'std::deque<std::tuple<int, int, int> >::value_type {aka std::tuple<int, int, int>}' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {int&, int&, int&}; <template-parameter-2-2> = void; _Elements = {int, int, int}]' dq.push_front({x_start, y_start, start_mask}); ^ escapelight.cpp:114:14: error: expected unqualified-id before '[' token auto [r, c, mask] = dq.front(); ^ escapelight.cpp:117:33: error: 'r' was not declared in this scope int current_dist = dist[r][c][mask]; ^ escapelight.cpp:117:36: error: 'c' was not declared in this scope int current_dist = dist[r][c][mask]; ^ escapelight.cpp:117:39: error: 'mask' was not declared in this scope int current_dist = dist[r][c][mask]; ^ escapelight.cpp:125:47: error: no matching function for call to 'std::deque<std::tuple<int, int, int> >::push_front(<brace-enclosed initializer list>)' dq.push_front({r, c, new_mask}); ^ escapelight.cpp:125:47: note: candidates are: In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/c++/4.8/queue:60, from escapelight.cpp:3: /usr/include/c++/4.8/bits/stl_deque.h:1359:7: note: void std::deque<_Tp, _Alloc>::push_front(const value_type&) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int, int>] push_front(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_deque.h:1359:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::tuple<int, int, int>&}' /usr/include/c++/4.8/bits/stl_deque.h:1372:7: note: void std::deque<_Tp, _Alloc>::push_front(std::deque<_Tp, _Alloc>::value_type&&) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int, int>] push_front(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_deque.h:1372:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::deque<std::tuple<int, int, int> >::value_type&& {aka std::tuple<int, int, int>&&}' escapelight.cpp:137:48: error: no matching function for call to 'std::deque<std::tuple<int, int, int> >::push_back(<brace-enclosed initializer list>)' dq.push_back({nr, nc, mask}); ^ escapelight.cpp:137:48: note: candidates are: In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/c++/4.8/queue:60, from escapelight.cpp:3: /usr/include/c++/4.8/bits/stl_deque.h:1390:7: note: void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int, int>] push_back(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_deque.h:1390:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::tuple<int, int, int>&}' /usr/include/c++/4.8/bits/stl_deque.h:1404:7: note: void std::deque<_Tp, _Alloc>::push_back(std::deque<_Tp, _Alloc>::value_type&&) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int, int>] push_back(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_deque.h:1404:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::deque<std::tuple<int, int, int> >::value_type&& {aka std::tuple<int, int, int>&&}'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema EscapeLight 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ă.