#2464
Se dau două șiruri S1 si S2 formate doar cu litere mici. Numim subșir de lungime K al unui șir a un șir a' = ai1, ai2,…, aiK astfel încât să avem: i1 < i2 < ... < iK.
Să se determine lungimea maximă a unui subșir din S1, format prin concatenarea unor anagrame ale șirului S2. Dintre toate subșirurile cu lungime maximă se va determina cel care este cel mai mic lexicografic. Un șir de lungime na se consideră mai mic lexicografic decât un șir de lungime nb dacă există un indice i, astfel încât a1=b1, a2=b1, …, ai-1=bi-1 și ai<bi. Un șir a este anagrama unui șir b dacă sortându-le crescător pe fiecare se obțin două șiruri identice.
| Problema | anagrame3 | Operații I/O |
anagrame3.in/anagrame3.out
|
|---|---|---|---|
| Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 32 MB
|
| Id soluție | #64813249 | Utilizator | |
| Fișier | anagrame3.cpp | Dimensiune | 658 B |
| Data încărcării | 03 Iunie 2026, 00:49 | Scor/rezultat | 0 puncte |
anagrame3.cpp: In function ‘int main()’: anagrame3.cpp:4:23: warning: variable ‘min1’ set but not used [-Wunused-but-set-variable] 4 | { int x,y,a,b,c,d,e,f,min1,min2,max1,max2; | ^~~~ anagrame3.cpp:4:28: warning: variable ‘min2’ set but not used [-Wunused-but-set-variable] 4 | { int x,y,a,b,c,d,e,f,min1,min2,max1,max2; | ^~~~ anagrame3.cpp:36:3: warning: ‘max1’ may be used uninitialized [-Wmaybe-uninitialized] 36 | if(max1>=max2) | ^~ anagrame3.cpp:4:33: note: ‘max1’ was declared here 4 | { int x,y,a,b,c,d,e,f,min1,min2,max1,max2; | ^~~~ anagrame3.cpp:36:3: warning: ‘max2’ may be used uninitialized [-Wmaybe-uninitialized] 36 | if(max1>=max2) | ^~ anagrame3.cpp:4:38: note: ‘max2’ was declared here 4 | { int x,y,a,b,c,d,e,f,min1,min2,max1,max2; | ^~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 0 | 0.002 secunde | Raspuns gresit. | 3 | 0 | ||
| 1 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 2 | 0.002 secunde | Raspuns gresit. | 3 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 5 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 6 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 7 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 8 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 9 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 10 | 0.001 secunde | Raspuns gresit. | 2 | 0 | ||
| 11 | 0.001 secunde | Raspuns gresit. | 2 | 0 | ||
| 12 | 0.001 secunde | Raspuns gresit. | 2 | 0 | ||
| 13 | 0.001 secunde | Raspuns gresit. | 2 | 0 | ||
| 14 | 0.001 secunde | Raspuns gresit. | 5 | 0 | ||
| 15 | 0.002 secunde | Raspuns gresit. | 5 | 0 | ||
| 16 | 0.002 secunde | Raspuns gresit. | 5 | 0 | ||
| 17 | 0.002 secunde | Raspuns gresit. | 2 | 0 | ||
| 18 | 0.001 secunde | Raspuns gresit. | 2 | 0 | ||
| 19 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 20 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 21 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 22 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 23 | 0.002 secunde | Raspuns gresit. | 4 | 0 | ||
| 24 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 25 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 26 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 27 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 28 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 29 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema anagrame3 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ă.