#4806
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 | #58073200 | Utilizator | |
Fișier | escapelight.cpp | Dimensiune | 3.53 KB |
Data încărcării | 12 Mai 2025, 19:29 | Scor / rezultat | Eroare de compilare |
escapelight.cpp: In function 'int main()': escapelight.cpp:52:41: error: converting to 'std::set<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}]' visited.insert({x_start, y_start, 0}); ^ escapelight.cpp:55:14: error: expected unqualified-id before '[' token auto [state, dist] = q.front(); ^ escapelight.cpp:58:17: error: 'state' was not declared in this scope int x = state.x, y = state.y, mask = state.mask; ^ escapelight.cpp:60:28: error: 'y' was not declared in this scope if (x == x_stop && y == y_stop) { ^ escapelight.cpp:61:21: error: 'dist' was not declared in this scope fout << dist << '\n'; ^ escapelight.cpp:68:32: error: 'y' was not declared in this scope bool are_intr = tip[x][y] == 3 && id_intr.count({x, y}); ^ escapelight.cpp:68:63: error: no matching function for call to 'std::map<std::pair<int, int>, int>::count(<brace-enclosed initializer list>)' bool are_intr = tip[x][y] == 3 && id_intr.count({x, y}); ^ escapelight.cpp:68:63: note: candidate is: In file included from /usr/include/c++/4.8/map:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80, from escapelight.cpp:1: /usr/include/c++/4.8/bits/stl_map.h:848:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::size_type std::map<_Key, _Tp, _Compare, _Alloc>::count(const key_type&) const [with _Key = std::pair<int, int>; _Tp = int; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::size_type = unsigned int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>] count(const key_type& __x) const ^ /usr/include/c++/4.8/bits/stl_map.h:848:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::pair<int, int>&}' escapelight.cpp:70:37: error: 'mask' was not declared in this scope vector<int> masks_to_try = {mask}; ^ escapelight.cpp:70:41: error: could not convert '{<expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>' vector<int> masks_to_try = {mask}; ^ escapelight.cpp:73:30: error: no match for 'operator[]' (operand types are 'std::map<std::pair<int, int>, int>' and '<brace-enclosed initializer list>') int idx = id_intr[{x, y}]; ^ escapelight.cpp:73:30: note: candidates are: In file included from /usr/include/c++/4.8/map:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80, from escapelight.cpp:1: /usr/include/c++/4.8/bits/stl_map.h:456:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<int, int>; _Tp = int; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>] operator[](const key_type& __k) ^ /usr/include/c++/4.8/bits/stl_map.h:456:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_map.h:476:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<int, int>; _Tp = int; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>] operator[](key_type&& __k) ^ /usr/include/c++/4.8/bits/stl_map.h:476:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<int, int>, int>::key_type&& {aka std::pair<int, int>&&}' escapelight.cpp:91:32: error: expected unqualified-id before '[' token for (auto& [i, j] : id_intr) { ^ escapelight.cpp:91:32: error: expected ';' before '[' token escapelight.cpp:91:33: error: 'i' was not declared in this scope for (auto& [i, j] : id_intr) { ^ escapelight.cpp:91:36: error: 'j' was not declared in this scope for (auto& [i, j] : id_intr) { ^ escapelight.cpp: In lambda function: escapelight.cpp:91:39: error: expected '{' before ':' token for (auto& [i, j] : id_intr) { ^ escapelight.cpp: In function 'int main()': escapelight.cpp:91:39: error: expected ';' before ':' token escapelight.cpp:91:39: error: expected primary-expression before ':' token escapelight.cpp:91:39: error: expected ')' before ':' token escapelight.cpp:91:39: error: expected primary-expression before ':' token escapelight.cpp:91:39: error: expected ';' before ':' token escapelight.cpp:117:1: error: expected '}' at end of input } ^ escapelight.cpp:117:1: error: expected '}' at end of input escapelight.cpp:117:1: error: expected '}' at end of input escapelight.cpp:78:18: warning: unused variable 'new_mask' [-Wunused-variable] for (int new_mask : masks_to_try) { ^ escapelight.cpp:117:1: error: expected '}' at end of input } ^ escapelight.cpp:117:1: error: expected '}' at end of input
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ă.