#4390
Fie S un șir de caractere de lungime N indexat de la 1. Pe un astfel de șir se definește operația swap: se alege un indice i (1 ≤ i < N) și se interschimbă caracterele S[i] și S[i + 1]. Numărul norocos corespunzător unui șir S este egal cu numărul minim de operații swap ce trebuie efectuate succesiv pentru a obține cel puțin o subsecvență bingo în șirul S. Dacă subsecvența bingo apare în șirul inițial, numărul norocos este egal cu 0. Se dă un număr natural T și T șiruri de caractere. Să se determine pentru fiecare șir dat S[i] (1 ≤ i ≤ T), numărul său norocos.
| Problema | bingo | Operații I/O |
bingo.in/bingo.out
|
|---|---|---|---|
| Limita timp | 0.6 secunde | Limita memorie |
Total: 32 MB
/
Stivă 8 MB
|
| Id soluție | #62748923 | Utilizator | |
| Fișier | bingo.cpp | Dimensiune | 3.33 KB |
| Data încărcării | 01 Februarie 2026, 10:22 | Scor/rezultat | 30 puncte |
bingo.cpp: In function 'void solve()': bingo.cpp:37:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < s.size(); i++){ ^ bingo.cpp:55:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 2; i < s.size() - 2; i++){ ^ bingo.cpp:75:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] else if (sol == v[j].size() - 1){ ^ bingo.cpp: In function 'int find_destination(char)': bingo.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0 secunde | Raspuns gresit. | 4 | 0 | ||
| 2 | 0 secunde | Raspuns gresit. | 13 | 0 | ||
| 3 | 0.044 secunde | Raspuns gresit. | 3 | 0 | ||
| 4 | 0.036 secunde | Raspuns gresit. | 3 | 0 | ||
| 5 | 0.044 secunde | OK. | 3 | 3 | ||
| 6 | 0.044 secunde | Raspuns gresit. | 3 | 0 | ||
| 7 | 0.036 secunde | Raspuns gresit. | 3 | 0 | ||
| 8 | 0.032 secunde | Raspuns gresit. | 2 | 0 | ||
| 9 | 0.032 secunde | Raspuns gresit. | 2 | 0 | ||
| 10 | 0.032 secunde | Raspuns gresit. | 2 | 0 | ||
| 11 | 0.036 secunde | Raspuns gresit. | 2 | 0 | ||
| 12 | 0.036 secunde | Raspuns gresit. | 2 | 0 | ||
| 13 | 0.032 secunde | Raspuns gresit. | 2 | 0 | ||
| 14 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
| 15 | 0.032 secunde | Raspuns gresit. | 2 | 0 | ||
| 16 | 0.036 secunde | Raspuns gresit. | 1 | 0 | ||
| 17 | 0.044 secunde | OK. | 5 | 5 | ||
| 18 | 0.044 secunde | Raspuns gresit. | 4 | 0 | ||
| 19 | 0.044 secunde | Raspuns gresit. | 4 | 0 | ||
| 20 | 0.04 secunde | Raspuns gresit. | 4 | 0 | ||
| 21 | 0.04 secunde | Raspuns gresit. | 4 | 0 | ||
| 22 | 0.044 secunde | OK. | 4 | 4 | ||
| 23 | 0.044 secunde | OK. | 4 | 4 | ||
| 24 | 0.048 secunde | OK. | 4 | 4 | ||
| 25 | 0.064 secunde | OK. | 10 | 10 | ||
| 26 | 0.04 secunde | Raspuns gresit. | 4 | 0 | ||
| 27 | 0.032 secunde | Raspuns gresit. | 4 | 0 | ||
| Punctaj total | 30 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema bingo 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ă.