#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 | #64259962 | Utilizator | |
| Fișier | crossword.cpp | Dimensiune | 7.04 KB |
| Data încărcării | 26 Aprilie 2026, 21:19 | Scor/rezultat | 100 puncte |
crossword.cpp: In function ‘bool ok(int)’: crossword.cpp:56:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 56 | for (int i = 0; i < slotK.intersections.size(); i++) | ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ crossword.cpp: In function ‘void print()’: crossword.cpp:83:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Slot>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 83 | for (int k = 0; k < slots.size(); k++) | ~~^~~~~~~~~~~~~~ crossword.cpp:84:16: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 84 | if (slots[k].i == i) | ^ crossword.cpp:90:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Slot>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 90 | for (int k = 0; k < currentVerticalSlots.size(); k++) | ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ crossword.cpp:110:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Slot>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 110 | for (int k = 0; k < currentVerticalSlots.size(); k++) | ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ crossword.cpp: In function ‘void bck(int)’: crossword.cpp:136:23: 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] 136 | for (int i = 0; i < words.size(); i++) | ~~^~~~~~~~~~~~~~ crossword.cpp:140:27: warning: comparison of integer expressions of different signedness: ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 140 | if (word.length() != slot.len) | ~~~~~~~~~~~~~~^~~~~~~~~~~ crossword.cpp:153:19: 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] 153 | if (k == words.size() - 1) | ~~^~~~~~~~~~~~~~~~~~~ crossword.cpp: In function ‘int main()’: crossword.cpp:230:39: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Slot>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 230 | for (int i = 0; i < slots.size(); i++) | ~~^~~~~~~~~~~~~~ crossword.cpp:265:39: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Slot>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 265 | for (int i = 0; i < slots.size(); i++) | ~~^~~~~~~~~~~~~~ crossword.cpp:174:10: warning: variable ‘linesContainingSlots’ set but not used [-Wunused-but-set-variable] 174 | bool linesContainingSlots[n]; | ^~~~~~~~~~~~~~~~~~~~
| 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.001 secunde | OK. | 2 | 2 | ||
| 5 | 0.002 secunde | OK. | 2 | 2 | ||
| 6 | 0.001 secunde | OK. | 2 | 2 | ||
| 7 | 0.001 secunde | OK. | 2 | 2 | ||
| 8 | 0.001 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.009 secunde | OK. | 2 | 2 | ||
| 15 | 0.006 secunde | OK. | 2 | 2 | ||
| 16 | 0.008 secunde | OK. | 2 | 2 | ||
| 17 | 0.015 secunde | OK. | 2 | 2 | ||
| 18 | 0.022 secunde | OK. | 2 | 2 | ||
| 19 | 0.031 secunde | OK. | 2 | 2 | ||
| 20 | 0.047 secunde | OK. | 2 | 2 | ||
| 21 | 0.066 secunde | OK. | 5 | 5 | ||
| 22 | 0.092 secunde | OK. | 5 | 5 | ||
| 23 | 0.099 secunde | OK. | 5 | 5 | ||
| 24 | 0.089 secunde | OK. | 5 | 5 | ||
| 25 | 0.002 secunde | OK. | 4 | 4 | ||
| 26 | 0.002 secunde | OK. | 4 | 4 | ||
| 27 | 0.001 secunde | OK. | 4 | 4 | ||
| 28 | 0.007 secunde | OK. | 4 | 4 | ||
| 29 | 0.02 secunde | OK. | 4 | 4 | ||
| 30 | 0.005 secunde | OK. | 4 | 4 | ||
| 31 | 0.079 secunde | OK. | 4 | 4 | ||
| 32 | 0.078 secunde | OK. | 3 | 3 | ||
| Punctaj total | 100 | |||||
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ă.