#2714
FrecvImp
Se dă un șir format din n
numere naturale. Toate valorile putere a lui 2
din acest șir au frecvență pară, cu o singură excepție. Determinați această valoare – putere a lui 2
cu frecvență impară.
Problema | FrecvImp | Operații I/O |
frecvimp.in /frecvimp.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0.1 MB
|
Id soluție | #53721829 | Utilizator | |
Fișier | frecvimp.cpp | Dimensiune | 655 B |
Data încărcării | 09 Noiembrie 2024, 17:31 | Scor / rezultat | Eroare de compilare |
frecvimp.cpp: In function 'int main()': frecvimp.cpp:22:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < n; i++) ^ frecvimp.cpp:26:14: error: no match for 'operator[]' (operand types are 'std::unordered_map<long long unsigned int, long long unsigned int>' and '__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >') m[lower_bound(powers.begin(),powers.end(), k)]++; ^ frecvimp.cpp:26:14: note: candidates are: In file included from /usr/include/c++/4.8/unordered_map:48:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:115, from frecvimp.cpp:1: /usr/include/c++/4.8/bits/unordered_map.h:595:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = long long unsigned int; _Tp = long long unsigned int; _Hash = std::hash<long long unsigned int>; _Pred = std::equal_to<long long unsigned int>; _Alloc = std::allocator<std::pair<const long long unsigned int, long long unsigned int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = long long unsigned int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = long long unsigned int] operator[](const key_type& __k) ^ /usr/include/c++/4.8/bits/unordered_map.h:595:7: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >' to 'const key_type& {aka const long long unsigned int&}' /usr/include/c++/4.8/bits/unordered_map.h:599:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type&&) [with _Key = long long unsigned int; _Tp = long long unsigned int; _Hash = std::hash<long long unsigned int>; _Pred = std::equal_to<long long unsigned int>; _Alloc = std::allocator<std::pair<const long long unsigned int, long long unsigned int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = long long unsigned int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = long long unsigned int] operator[](key_type&& __k) ^ /usr/include/c++/4.8/bits/unordered_map.h:599:7: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >' to 'std::unordered_map<long long unsigned int, long long unsigned int>::key_type&& {aka long long unsigned int&&}' frecvimp.cpp:27:13: error: no match for 'operator[]' (operand types are 'std::unordered_map<long long unsigned int, long long unsigned int>' and '__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >') if(m[lower_bound(powers.begin(),powers.end(), k)] & 1) ^ frecvimp.cpp:27:13: note: candidates are: In file included from /usr/include/c++/4.8/unordered_map:48:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:115, from frecvimp.cpp:1: /usr/include/c++/4.8/bits/unordered_map.h:595:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = long long unsigned int; _Tp = long long unsigned int; _Hash = std::hash<long long unsigned int>; _Pred = std::equal_to<long long unsigned int>; _Alloc = std::allocator<std::pair<const long long unsigned int, long long unsigned int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = long long unsigned int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = long long unsigned int] operator[](const key_type& __k) ^ /usr/include/c++/4.8/bits/unordered_map.h:595:7: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >' to 'const key_type& {aka const long long unsigned int&}' /usr/include/c++/4.8/bits/unordered_map.h:599:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type&&) [with _Key = long long unsigned int; _Tp = long long unsigned int; _Hash = std::hash<long long unsigned int>; _Pred = std::equal_to<long long unsigned int>; _Alloc = std::allocator<std::pair<const long long unsigned int, long long unsigned int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = long long unsigned int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = long long unsigned int] operator[](key_type&& __k) ^ /usr/include/c++/4.8/bits/unordered_map.h:599:7: note: no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >' to 'std::unordered_map<long long unsigned int, long long unsigned int>::key_type&& {aka long long unsigned int&&}'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FrecvImp 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ă.