#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 | #58513918 | Utilizator | |
Fișier | escapelight.cpp | Dimensiune | 2.30 KB |
Data încărcării | 12 Iunie 2025, 21:42 | Scor / rezultat | Eroare de compilare |
escapelight.cpp: In lambda function: escapelight.cpp:40:7: error: 'mat' is not captured if (mat[cell.first][cell.second] == 3) { return true; } ^ escapelight.cpp:41:7: error: 'mat' is not captured if (mat[cell.first][cell.second] == 2) { return false; } ^ escapelight.cpp:42:50: error: 'lightmask' is not captured int cnt = __builtin_popcount(active_switches & lightmask[cell.first][cell.second]); ^ escapelight.cpp:43:23: error: 'mat' is not captured return ((cnt & 1) ^ mat[cell.first][cell.second]); ^ escapelight.cpp: In lambda function: escapelight.cpp:47:43: error: 'n' is not captured return 1 <= cell.first && cell.first <= n && 1 <= cell.second && cell.second <= m; ^ escapelight.cpp:47:83: error: 'm' is not captured return 1 <= cell.first && cell.first <= n && 1 <= cell.second && cell.second <= m; ^ escapelight.cpp: In lambda function: escapelight.cpp:54:37: error: 'n' is not captured vector<vector<vector<bool>>> seen(n + 1, vector<vector<bool>>(m + 1, vector<bool>((1 << 11), false))); ^ escapelight.cpp:54:65: error: 'm' is not captured vector<vector<vector<bool>>> seen(n + 1, vector<vector<bool>>(m + 1, vector<bool>((1 << 11), false))); ^ escapelight.cpp:58:9: error: expected unqualified-id before '[' token auto [x, y, mask, dist] = q.front(); ^ escapelight.cpp:60:8: error: 'end' is not captured if (end == make_pair(x, y)) { ^ escapelight.cpp:60:25: error: 'x' was not declared in this scope if (end == make_pair(x, y)) { ^ escapelight.cpp:60:28: error: 'y' was not declared in this scope if (end == make_pair(x, y)) { ^ escapelight.cpp:61:5: error: 'out' is not captured out << dist; ^ escapelight.cpp:61:12: error: 'dist' was not declared in this scope out << dist; ^ escapelight.cpp:64:8: error: 'mat' is not captured if (mat[x][y] == 3 && !seen[x][y][mask ^ (1 << switches[{x, y}])]) { ^ escapelight.cpp:64:12: error: 'x' was not declared in this scope if (mat[x][y] == 3 && !seen[x][y][mask ^ (1 << switches[{x, y}])]) { ^ escapelight.cpp:64:15: error: 'y' was not declared in this scope if (mat[x][y] == 3 && !seen[x][y][mask ^ (1 << switches[{x, y}])]) { ^ escapelight.cpp:64:38: error: 'mask' was not declared in this scope if (mat[x][y] == 3 && !seen[x][y][mask ^ (1 << switches[{x, y}])]) { ^ escapelight.cpp:64:51: error: 'switches' is not captured if (mat[x][y] == 3 && !seen[x][y][mask ^ (1 << switches[{x, y}])]) { ^ escapelight.cpp:65:29: error: 'switches' is not captured seen[x][y][mask ^ (1 << switches[{x, y}])] = true; ^ escapelight.cpp:66:38: error: 'switches' is not captured q.push_front({x, y, mask ^ (1 << switches[{x, y}]), dist}); ^ escapelight.cpp:66:57: error: 'dist' was not declared in this scope q.push_front({x, y, mask ^ (1 << switches[{x, y}]), dist}); ^ escapelight.cpp:66:62: error: no matching function for call to 'std::deque<std::array<int, 4u> >::push_front(<brace-enclosed initializer list>)' q.push_front({x, y, mask ^ (1 << switches[{x, y}]), dist}); ^ escapelight.cpp:66:62: note: candidates are: In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from escapelight.cpp:1: /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::array<int, 4u>; _Alloc = std::allocator<std::array<int, 4u> >; std::deque<_Tp, _Alloc>::value_type = std::array<int, 4u>] 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::array<int, 4u>&}' /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::array<int, 4u>; _Alloc = std::allocator<std::array<int, 4u> >; std::deque<_Tp, _Alloc>::value_type = std::array<int, 4u>] 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::array<int, 4u> >::value_type&& {aka std::array<int, 4u>&&}' escapelight.cpp:69:16: error: 'x' was not declared in this scope int newx = x + dx[dir], newy = y + dy[dir]; ^ escapelight.cpp:70:9: error: 'inside' is not captured if (inside({newx, newy}) && is_lit({newx, newy}, mask) && !seen[newx][newy][mask]) { ^ escapelight.cpp:70:23: error: 'newy' was not declared in this scope if (inside({newx, newy}) && is_lit({newx, newy}, mask) && !seen[newx][newy][mask]) { ^ escapelight.cpp:70:33: error: 'is_lit' is not captured if (inside({newx, newy}) && is_lit({newx, newy}, mask) && !seen[newx][newy][mask]) { ^ escapelight.cpp:70:54: error: 'mask' was not declared in this scope if (inside({newx, newy}) && is_lit({newx, newy}, mask) && !seen[newx][newy][mask]) { ^ escapelight.cpp:71:37: error: 'dist' was not declared in this scope q.push_back({newx, newy, mask, dist + 1}); ^ escapelight.cpp:71:46: error: no matching function for call to 'std::deque<std::array<int, 4u> >::push_back(<brace-enclosed initializer list>)' q.push_back({newx, newy, mask, dist + 1}); ^ escapelight.cpp:71:46: note: candidates are: In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from escapelight.cpp:1: /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::array<int, 4u>; _Alloc = std::allocator<std::array<int, 4u> >; std::deque<_Tp, _Alloc>::value_type = std::array<int, 4u>] 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::array<int, 4u>&}' /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::array<int, 4u>; _Alloc = std::allocator<std::array<int, 4u> >; std::deque<_Tp, _Alloc>::value_type = std::array<int, 4u>] 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::array<int, 4u> >::value_type&& {aka std::array<int, 4u>&&}' escapelight.cpp:52:13: warning: unused variable 'dy' [-Wunused-variable] const int dy[4] = {0, 1, 0, -1}; ^ escapelight.cpp: In lambda function: escapelight.cpp:44:2: warning: control reaches end of non-void function [-Wreturn-type] }; ^
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ă.