#3716
Se dă o matrice de rebus cu n linii și m coloane. Fiecare celulă conține unul dintre caracterele:
'+' – celulă blocată (nu poate conține literă)'-' – celulă liberă (trebuie completată cu o literă)De asemenea, se dă o listă de W cuvinte (formate doar din litere mari A-Z) care trebuie completate în rebus.
Un cuvânt poate fi plasat:
într-un segment maximal de celule '-' consecutive (numit slot). Lungimea cuvântului trebuie să fie egală cu lungimea slotului.
Două cuvinte se pot intersecta (o celulă poate aparține atât unui slot orizontal, cât și unuia vertical), dar în acest caz litera rezultată în acea celulă trebuie să coincidă pentru ambele cuvinte.
Fiecare cuvânt din listă trebuie folosit exact o singură dată.
hackerrank.com (modificată)
| Problema | Crossword | Operații I/O |
crossword.in/crossword.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 64 MB
|
| Id soluție | #64908075 | Utilizator | |
| Fișier | crossword.cpp | Dimensiune | 4.86 KB |
| Data încărcării | 11 Iunie 2026, 16:01 | Scor/rezultat | 71 puncte |
crossword.cpp: In function ‘std::vector<std::pair<pos, pos> > get_slots(std::vector<std::__cxx11::basic_string<char> >)’: crossword.cpp:76:38: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<pos>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 76 | for(int idx = 0; idx < positions.size(); idx ++){ | ~~~~^~~~~~~~~~~~~~~~~~ crossword.cpp: In function ‘bool backtrack(std::vector<std::__cxx11::basic_string<char> >&, std::vector<std::pair<pos, pos> >&, int, std::vector<bool>&)’: crossword.cpp:93:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<pos, pos> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 93 | if(slot_idx >= slots.size()){ | ~~~~~~~~~^~~~~~~~~~~~~~~ crossword.cpp:118:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::__cxx11::basic_string<char> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 118 | for(int idx = 0; idx < words.size(); idx++){ | ~~~~^~~~~~~~~~~~~~ crossword.cpp:123:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 123 | if(size != words[idx].length()){ | ~~~~~^~~~~~~~~~~~~~~~~~~~~~ crossword.cpp:103:10: warning: variable ‘horizontal’ set but not used [-Wunused-but-set-variable] 103 | bool horizontal = false; | ^~~~~~~~~~ crossword.cpp: In function ‘int main()’: crossword.cpp:178:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 178 | while(i < line.length()){ | ~~^~~~~~~~~~~~~~~ crossword.cpp:180:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 180 | while(i < line.length() && line[i] != ';'){ | ~~^~~~~~~~~~~~~~~ crossword.cpp:187:14: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 187 | if(i < line.length() && line[i] == ';'){ | ~~^~~~~~~~~~~~~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 5 | 5 | Exemplu | |
| 2 | 0.001 secunde | OK. | 5 | 5 | Exemplu | |
| 3 | 0.001 secunde | OK. | 5 | 5 | Exemplu | |
| 4 | 0.002 secunde | OK. | 2 | 2 | ||
| 5 | 0.001 secunde | OK. | 2 | 2 | ||
| 6 | 0.001 secunde | OK. | 2 | 2 | ||
| 7 | 0.001 secunde | OK. | 2 | 2 | ||
| 8 | 0.002 secunde | OK. | 2 | 2 | ||
| 9 | 0.001 secunde | OK. | 2 | 2 | ||
| 10 | 0.001 secunde | OK. | 2 | 2 | ||
| 11 | 0.001 secunde | OK. | 2 | 2 | ||
| 12 | 0.002 secunde | OK. | 2 | 2 | ||
| 13 | 0.003 secunde | OK. | 2 | 2 | ||
| 14 | 0.002 secunde | OK. | 2 | 2 | ||
| 15 | 0.004 secunde | OK. | 2 | 2 | ||
| 16 | 0.008 secunde | OK. | 2 | 2 | ||
| 17 | 0.015 secunde | OK. | 2 | 2 | ||
| 18 | 0.035 secunde | OK. | 2 | 2 | ||
| 19 | 0.045 secunde | OK. | 2 | 2 | ||
| 20 | 0.051 secunde | Caught fatal signal 6 | 2 | 0 | ||
| 21 | 0.051 secunde | Caught fatal signal 6 | 5 | 0 | ||
| 22 | 0.053 secunde | Caught fatal signal 6 | 5 | 0 | ||
| 23 | 0.048 secunde | Caught fatal signal 6 | 5 | 0 | ||
| 24 | 0.058 secunde | Caught fatal signal 6 | 5 | 0 | ||
| 25 | 0.002 secunde | OK. | 4 | 4 | ||
| 26 | 0.003 secunde | OK. | 4 | 4 | ||
| 27 | 0.001 secunde | OK. | 4 | 4 | ||
| 28 | 0.006 secunde | OK. | 4 | 4 | ||
| 29 | 0.012 secunde | OK. | 4 | 4 | ||
| 30 | 0.001 secunde | OK. | 4 | 4 | ||
| 31 | 0.047 secunde | Caught fatal signal 6 | 4 | 0 | ||
| 32 | 0.048 secunde | Caught fatal signal 6 | 3 | 0 | ||
| Punctaj total | 71 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Crossword 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ă.