#3491
Se dă o matrice cu n linii și m coloane, formată din 2 tipuri de caractere: '$' și '.'. Trebuie acoperite toate caracterele '.' cu piese 1x2 sau 2x1. Dacă se poate realiza acoperirea într-un mod unic, se va afișa matricea completată, altfel se va afișa mesajul "altadata".
| Problema | Fill_1221 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.03 secunde | Limita memorie |
Total: 21 MB
/
Stivă 12 MB
|
| Id soluție | #64127674 | Utilizator | |
| Fișier | fill_1221.cpp | Dimensiune | 4.74 KB |
| Data încărcării | 19 Aprilie 2026, 11:50 | Scor/rezultat | Eroare de compilare |
fill_1221.cpp: In function ‘int main()’: fill_1221.cpp:82:30: warning: variable ‘c’ set but not used [-Wunused-but-set-variable] 82 | bool c = false; | ^ fill_1221.cpp:115:32: error: cannot bind non-const lvalue reference of type ‘std::vector<int>&’ to an rvalue of type ‘std::vector<int>’ 115 | if(!isValid({i, j + 1}) || grid[i][j + 1] != closing[grid[i][j]]){ | ~~~~~~~^~~~~~~~~~~~ In file included from /usr/include/c++/13/vector:66, from fill_1221.cpp:3: /usr/include/c++/13/bits/stl_vector.h:678:7: note: after user-defined conversion: ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]’ 678 | vector(initializer_list<value_type> __l, | ^~~~~~ fill_1221.cpp:15:27: note: initializing argument 1 of ‘bool isValid(std::vector<int>&)’ 15 | bool isValid(vector<int>& pos){ | ~~~~~~~~~~~~~^~~ fill_1221.cpp:121:32: error: cannot bind non-const lvalue reference of type ‘std::vector<int>&’ to an rvalue of type ‘std::vector<int>’ 121 | if(!isValid({i, j - 1}) || grid[i][j - 1] != closing[grid[i][j]]){ | ~~~~~~~^~~~~~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:678:7: note: after user-defined conversion: ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]’ 678 | vector(initializer_list<value_type> __l, | ^~~~~~ fill_1221.cpp:15:27: note: initializing argument 1 of ‘bool isValid(std::vector<int>&)’ 15 | bool isValid(vector<int>& pos){ | ~~~~~~~~~~~~~^~~ fill_1221.cpp:127:33: error: cannot bind non-const lvalue reference of type ‘std::vector<int>&’ to an rvalue of type ‘std::vector<int>’ 127 | if(!isValid({i + 1, j}) || grid[i + 1][j] != closing[grid[i][j]]){ | ~~~~~~~^~~~~~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:678:7: note: after user-defined conversion: ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]’ 678 | vector(initializer_list<value_type> __l, | ^~~~~~ fill_1221.cpp:15:27: note: initializing argument 1 of ‘bool isValid(std::vector<int>&)’ 15 | bool isValid(vector<int>& pos){ | ~~~~~~~~~~~~~^~~ fill_1221.cpp:133:32: error: cannot bind non-const lvalue reference of type ‘std::vector<int>&’ to an rvalue of type ‘std::vector<int>’ 133 | if(!isValid({i - 1, j}) || grid[i - 1][j] != closing[grid[i][j]]){ | ~~~~~~~^~~~~~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:678:7: note: after user-defined conversion: ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]’ 678 | vector(initializer_list<value_type> __l, | ^~~~~~ fill_1221.cpp:15:27: note: initializing argument 1 of ‘bool isValid(std::vector<int>&)’ 15 | bool isValid(vector<int>& pos){ | ~~~~~~~~~~~~~^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Fill_1221 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ă.