#4443
Steve Stonecutter se află într-o lume formată din cuburi, iar fiecare cub aparține unui singur biom. Cuburile sunt dispuse într-o linie și sunt numerotate de la 1 la N. Se consideră că blocurile i și i + 1 sunt vecine între ele pentru toate valorile i de la 1 la N - 1. Putem reprezenta această lume ca și un șir de caractere S de lungime N format din litere mici ale alfabetului limbii engleze, numerotat de la 1 la N, unde al i-lea caracter reprezintă biomul din care face parte al i-lea cub. Aceste mișcări se pot realiza dacă și numai dacă poziția în care Steve vrea să se deplaseze există. Începând de la cubul 1, Steve dorește să ajungă la cubul N cu cost minim, așa că vă roagă pe voi să aflați care este acest cost.
| Problema | biom | Operații I/O |
biom.in/biom.out
|
|---|---|---|---|
| Limita timp | 0.6 secunde | Limita memorie |
Total: 256 MB
/
Stivă 64 MB
|
| Id soluție | #64087749 | Utilizator | |
| Fișier | biom.cpp | Dimensiune | 1.35 KB |
| Data încărcării | 16 Aprilie 2026, 11:46 | Scor/rezultat | 65 puncte |
biom.cpp: In function ‘int main()’: biom.cpp:61:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 61 | for(int i = 0; i < s.length(); i++) | ~~^~~~~~~~~~~~ biom.cpp:62:18: warning: array subscript has type ‘char’ [-Wchar-subscripts] 62 | if(T[s[i]]) ///daca exista din biom | ^ biom.cpp:64:28: warning: array subscript has type ‘char’ [-Wchar-subscripts] 64 | P[i+1] = T[s[i]]; ///acesta este anteriorul | ^ biom.cpp:65:21: warning: array subscript has type ‘char’ [-Wchar-subscripts] 65 | N[T[s[i]]] = i+1; ///acesta este urmatorul | ^ biom.cpp:66:19: warning: array subscript has type ‘char’ [-Wchar-subscripts] 66 | T[s[i]] = i+1; | ^ biom.cpp:69:19: warning: array subscript has type ‘char’ [-Wchar-subscripts] 69 | T[s[i]] = i+1; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 3 | 3 | ||
| 2 | 0.001 secunde | OK. | 4 | 4 | ||
| 3 | 0.001 secunde | OK. | 4 | 4 | ||
| 4 | 0.001 secunde | OK. | 4 | 4 | ||
| 5 | 0.092 secunde | Raspuns gresit. | 4 | 0 | ||
| 6 | 0.195 secunde | OK. | 5 | 5 | ||
| 7 | 0.127 secunde | Raspuns gresit. | 5 | 0 | ||
| 8 | 0.116 secunde | OK. | 5 | 5 | ||
| 9 | 0.166 secunde | OK. | 2 | 2 | ||
| 10 | 0.121 secunde | OK. | 2 | 2 | ||
| 11 | 0.15 secunde | OK. | 2 | 2 | ||
| 12 | 0.159 secunde | OK. | 2 | 2 | ||
| 13 | 0.19 secunde | OK. | 2 | 2 | ||
| 14 | 0.015 secunde | Raspuns gresit. | 1 | 0 | ||
| 15 | 0.013 secunde | OK. | 1 | 1 | ||
| 16 | 0.016 secunde | OK. | 1 | 1 | ||
| 17 | 0.015 secunde | OK. | 1 | 1 | ||
| 18 | 0.019 secunde | OK. | 2 | 2 | ||
| 19 | 0.011 secunde | Raspuns gresit. | 2 | 0 | ||
| 20 | 0.184 secunde | OK. | 2 | 2 | ||
| 21 | 0.137 secunde | OK. | 2 | 2 | ||
| 22 | 0.134 secunde | OK. | 2 | 2 | ||
| 23 | 0.11 secunde | OK. | 2 | 2 | ||
| 24 | 0.039 secunde | OK. | 3 | 3 | ||
| 25 | 0.115 secunde | OK. | 1 | 1 | ||
| 26 | 0.155 secunde | OK. | 1 | 1 | ||
| 27 | 0.223 secunde | OK. | 1 | 1 | ||
| 28 | 0.148 secunde | OK. | 1 | 1 | ||
| 29 | 0.197 secunde | OK. | 1 | 1 | ||
| 30 | 0.18 secunde | OK. | 1 | 1 | ||
| 31 | 0.257 secunde | Raspuns gresit. | 1 | 0 | ||
| 32 | 0.296 secunde | Raspuns gresit. | 2 | 0 | ||
| 33 | 0.302 secunde | Raspuns gresit. | 2 | 0 | ||
| 34 | 0.298 secunde | Raspuns gresit. | 2 | 0 | ||
| 35 | 0.403 secunde | Raspuns gresit. | 2 | 0 | ||
| 36 | 0.309 secunde | Raspuns gresit. | 2 | 0 | ||
| 37 | 0.001 secunde | Raspuns gresit. | 2 | 0 | ||
| 38 | 0.188 secunde | Raspuns gresit. | 2 | 0 | ||
| 39 | 0.326 secunde | Raspuns gresit. | 2 | 0 | ||
| 40 | 0.359 secunde | Raspuns gresit. | 2 | 0 | ||
| 41 | 0.001 secunde | OK. | 2 | 2 | ||
| 42 | 0.001 secunde | OK. | 2 | 2 | ||
| 43 | 0.001 secunde | Raspuns gresit. | 2 | 0 | ||
| 44 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
| 45 | 0.001 secunde | OK. | 2 | 2 | ||
| 46 | 0.001 secunde | OK. | 2 | 2 | ||
| Punctaj total | 65 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema biom 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ă.