#4015
unique
Dându-se un șir de numere naturale, să se determine câte dintre ele apar o singură dată.
Problema | unique | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 0.2 MB
/
Stivă 0.2 MB
|
Id soluție | #57776502 | Utilizator | |
Fișier | unique.cpp | Dimensiune | 597 B |
Data încărcării | 15 Aprilie 2025, 17:23 | Scor / rezultat | Eroare de compilare |
unique.cpp: In function 'int main()': unique.cpp:15:13: error: no match for 'operator!' (operand type is 'std::vector<int>') if (!prima[x] && !urmatoare[x]) ^ unique.cpp:15:13: note: candidate is: unique.cpp:15:13: note: operator!(bool) <built-in> unique.cpp:15:13: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool' unique.cpp:15:26: error: no match for 'operator!' (operand type is 'std::vector<int>') if (!prima[x] && !urmatoare[x]) ^ unique.cpp:15:26: note: candidate is: unique.cpp:15:26: note: operator!(bool) <built-in> unique.cpp:15:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool' unique.cpp:17:22: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int') prima[x] = 1; ^ unique.cpp:17:22: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from unique.cpp:2: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' In file included from /usr/include/c++/4.8/vector:64:0, from unique.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' unique.cpp:19:30: error: no match for 'operator!' (operand type is 'std::vector<int>') else if (prima[x] && !urmatoare[x]) ^ unique.cpp:19:30: note: candidate is: unique.cpp:19:30: note: operator!(bool) <built-in> unique.cpp:19:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool' unique.cpp:21:26: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int') urmatoare[x] = 1; ^ unique.cpp:21:26: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from unique.cpp:2: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' In file included from /usr/include/c++/4.8/vector:64:0, from unique.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' unique.cpp:28:25: error: no match for 'operator!' (operand type is 'std::vector<int>') if (prima[i] && !urmatoare[i]) ^ unique.cpp:28:25: note: candidate is: unique.cpp:28:25: note: operator!(bool) <built-in> unique.cpp:28:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema unique 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ă.