#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 | #64623271 | Utilizator | |
| Fișier | distlungmax.cpp | Dimensiune | 651 B |
| Data încărcării | 19 Mai 2026, 09:35 | Scor/rezultat | Eroare de compilare |
distlungmax.cpp: In function ‘int main()’: distlungmax.cpp:9:5: error: ‘vector’ was not declared in this scope 9 | vector<string> v; | ^~~~~~ distlungmax.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 2 | #include<cstring> +++ |+#include <vector> 3 | using namespace std; distlungmax.cpp:9:18: error: expected primary-expression before ‘>’ token 9 | vector<string> v; | ^ distlungmax.cpp:9:20: error: ‘v’ was not declared in this scope 9 | vector<string> v; | ^ distlungmax.cpp:10:22: error: variable ‘std::istringstream b’ has initializer but incomplete type 10 | istringstream b(s); | ^ distlungmax.cpp:16:16: error: expected primary-expression before ‘int’ 16 | vector<int> w(300); | ^~~ distlungmax.cpp:18:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 18 | for(int j=0;j<s.size();j++) | ~^~~~~~~~~ distlungmax.cpp:19:17: error: ‘w’ was not declared in this scope 19 | if(!w[s[j]]) | ^
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ă.