#3534
Multiset_OOP
C++
Definiți în C++ clasa Multiset care va implementa multiset-uri de numere naturale în care se definesc operațiile:
Insert(x)
– inserează x
în multisetErase(x)
– elimină elementul de pe pozitia x
din multisetFind(x)
– returnează valoarea de pe pozitia x
din multisetProblema | Multiset_OOP | Operații I/O |
![]() multiset_oop.in /multiset_oop.out
|
---|---|---|---|
Limita timp | 0.35 secunde | Limita memorie |
Total: 30 MB
/
Stivă 5 MB
|
Id soluție | #58036854 | Utilizator | |
Fișier | multiset_oop.cpp | Dimensiune | 499 B |
Data încărcării | 09 Mai 2025, 21:27 | Scor / rezultat | Eroare de compilare |
multiset_oop.cpp: In member function 'int Multiset::Find(int)': multiset_oop.cpp:28:50: error: no matching function for call to 'std::multiset<int>::find(std::_Rb_tree_const_iterator<int>)' auto it = ms.find(next(ms.begin(), x - 1)); ^ multiset_oop.cpp:28:50: note: candidates are: In file included from /usr/include/c++/4.8/set:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from multiset_oop.cpp:1: /usr/include/c++/4.8/bits/stl_multiset.h:645:7: note: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::key_type = int] find(const key_type& __x) ^ /usr/include/c++/4.8/bits/stl_multiset.h:645:7: note: no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const key_type& {aka const int&}' /usr/include/c++/4.8/bits/stl_multiset.h:649:7: note: std::multiset<_Key, _Compare, _Alloc>::const_iterator std::multiset<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::key_type = int] find(const key_type& __x) const ^ /usr/include/c++/4.8/bits/stl_multiset.h:649:7: note: no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const key_type& {aka const int&}' multiset_oop.cpp: In function 'int main()': multiset_oop.cpp:61:43: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("multiset_oop.in", "r", stdin); ^ multiset_oop.cpp:62:45: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("multiset_oop.out", "w", stdout); ^ multiset_oop.cpp: In member function 'int Multiset::Find(int)': multiset_oop.cpp:31:5: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Multiset_OOP face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.