#2738
Se dă un șir de caractere care conține cuvinte formate din litere mici ale alfabetului englez și separate printr-un singur spațiu. Să se determine cel mai lung cuvânt care are toate literele distincte. Dacă nu există niciun cuvânt cu toate literele distincte se va afișa -1.
| Problema | DistLungMax | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64671120 | Utilizator | |
| Fișier | distlungmax.cpp | Dimensiune | 681 B |
| Data încărcării | 21 Mai 2026, 16:47 | Scor/rezultat | 80 puncte |
distlungmax.cpp: In function ‘int main()’: distlungmax.cpp:15:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 15 | for(int i=0;i<strlen(p);i++) | ~^~~~~~~~~~ distlungmax.cpp:26:25: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 26 | if(strlen(p)>lg) | ~~~~~~~~~^~~ distlungmax.cpp:14:17: warning: iteration 26 invokes undefined behavior [-Waggressive-loop-optimizations] 14 | f[i]=0; | ~~~~^~ distlungmax.cpp:13:22: note: within this loop 13 | for(int i=0;i<=26;i++) | ~^~~~ distlungmax.cpp:22:19: warning: iteration 26 invokes undefined behavior [-Waggressive-loop-optimizations] 22 | if(f[i]>1) ok=0; | ~~~^ distlungmax.cpp:20:22: note: within this loop 20 | for(int i=0;i<=26;i++) | ~^~~~ distlungmax.cpp:14:17: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [104, 107] is out of the bounds [0, 104] of object ‘f’ with type ‘int [26]’ [-Warray-bounds=] 14 | f[i]=0; | ~~~~^~ distlungmax.cpp:4:5: note: ‘f’ declared here 4 | int f[26]; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.003 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 3 | 0.001 secunde | OK. | 20 | 20 | ||
| 4 | 0.001 secunde | OK. | 20 | 20 | ||
| 5 | 0.002 secunde | OK. | 20 | 20 | ||
| Punctaj total | 80 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DistLungMax 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ă.