#3220
foto
Alina este pasionată de fotografiile alb-negru. Ea ales o imagine pe care a codificat-o binar într-o matrice de dimensiune n x m
cu valori 0
corespunzătoare pentru alb (pe care le-a numit puncte luminoase) și cu valori 1
corespunzătoare pentru negru (pe care le-a numit puncte întunecate). Astfel, ea identifică în imaginea codificată zone luminoase și zone întunecate, o zonă fiind o porțiune a matricei care conține elemente cu aceeași valoare, trecerea de la un element la altul al zonei făcându-se doar prin deplasări pe orizontală sau pe verticală. Ajutați-o pe Alina să găsească cea mai luminoasă zonă și determinați numărul de puncte luminoase ale acesteia.
Olimpiada Municipală Iași, clasa a X-a
Problema | foto | Operații I/O |
foto.in /foto.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #52725002 | Utilizator | |
Fișier | foto.cpp | Dimensiune | 1.21 KB |
Data încărcării | 07 Octombrie 2024, 23:58 | Scor / rezultat | Eroare de compilare |
foto.cpp: In function 'int iterativeDFS(int, int)': foto.cpp:17:14: error: expected unqualified-id before '[' token auto [x, y] = s.top(); ^ foto.cpp:19:13: error: 'x' was not declared in this scope if (x < 0 || x >= n || y < 0 || y >= m || matrix[x][y] == 1) { ^ foto.cpp:19:32: error: 'y' was not declared in this scope if (x < 0 || x >= n || y < 0 || y >= m || matrix[x][y] == 1) { ^ foto.cpp:22:16: error: 'x' was not declared in this scope matrix[x][y] = 1; // ^ foto.cpp:22:19: error: 'y' was not declared in this scope matrix[x][y] = 1; // ^ foto.cpp:26:26: error: no matching function for call to 'std::stack<std::pair<int, int> >::push(<brace-enclosed initializer list>)' s.push({x + 1, y}); ^ foto.cpp:26:26: note: candidates are: In file included from /usr/include/c++/4.8/stack:61:0, from foto.cpp:4: /usr/include/c++/4.8/bits/stl_stack.h:186:7: note: void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>] push(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_stack.h:186:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_stack.h:191:7: note: void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>] push(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_stack.h:191:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}' foto.cpp:27:26: error: no matching function for call to 'std::stack<std::pair<int, int> >::push(<brace-enclosed initializer list>)' s.push({x - 1, y}); ^ foto.cpp:27:26: note: candidates are: In file included from /usr/include/c++/4.8/stack:61:0, from foto.cpp:4: /usr/include/c++/4.8/bits/stl_stack.h:186:7: note: void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>] push(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_stack.h:186:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_stack.h:191:7: note: void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>] push(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_stack.h:191:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}' foto.cpp:28:26: error: no matching function for call to 'std::stack<std::pair<int, int> >::push(<brace-enclosed initializer list>)' s.push({x, y + 1}); ^ foto.cpp:28:26: note: candidates are: In file included from /usr/include/c++/4.8/stack:61:0, from foto.cpp:4: /usr/include/c++/4.8/bits/stl_stack.h:186:7: note: void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>] push(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_stack.h:186:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_stack.h:191:7: note: void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>] push(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_stack.h:191:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}' foto.cpp:29:26: error: no matching function for call to 'std::stack<std::pair<int, int> >::push(<brace-enclosed initializer list>)' s.push({x, y - 1}); ^ foto.cpp:29:26: note: candidates are: In file included from /usr/include/c++/4.8/stack:61:0, from foto.cpp:4: /usr/include/c++/4.8/bits/stl_stack.h:186:7: note: void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>] push(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_stack.h:186:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_stack.h:191:7: note: void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>] push(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_stack.h:191:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema foto 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ă.