#2746
Heap Sort
Se dă n
și un sir cu n
elemente, numere naturale. Folosind metoda HeapSort
, să se sorteze crescător șirul și să se afișeze elementele sale, separate prin câte un spațiu.
Problema | Heap Sort | Operații I/O |
heap_sort.in /heap_sort.out
|
---|---|---|---|
Limita timp | 0.35 secunde | Limita memorie |
Total: 4 MB
/
Stivă 1 MB
|
Id soluție | #46868959 | Utilizator | |
Fișier | heap_sort.cpp | Dimensiune | 430 B |
Data încărcării | 25 Noiembrie 2023, 11:33 | Scor / rezultat | Eroare de compilare |
heap_sort.cpp:14:24: error: no matching function for call to 'std::multiset<int>::multiset(int)' multiset<int> s(1000005); ^ heap_sort.cpp:14:24: note: candidates are: In file included from /usr/include/c++/4.8/set:62:0, from heap_sort.cpp:2: /usr/include/c++/4.8/bits/stl_multiset.h:214:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset(std::initializer_list<_Tp>, const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::allocator_type = std::allocator<int>] multiset(initializer_list<value_type> __l, ^ /usr/include/c++/4.8/bits/stl_multiset.h:214:7: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' /usr/include/c++/4.8/bits/stl_multiset.h:200:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset(std::multiset<_Key, _Compare, _Alloc>&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>] multiset(multiset&& __x) ^ /usr/include/c++/4.8/bits/stl_multiset.h:200:7: note: no known conversion for argument 1 from 'int' to 'std::multiset<int>&&' /usr/include/c++/4.8/bits/stl_multiset.h:189:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset(const std::multiset<_Key, _Compare, _Alloc>&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>] multiset(const multiset& __x) ^ /usr/include/c++/4.8/bits/stl_multiset.h:189:7: note: no known conversion for argument 1 from 'int' to 'const std::multiset<int>&' /usr/include/c++/4.8/bits/stl_multiset.h:176:9: note: template<class _InputIterator> std::multiset<_Key, _Compare, _Alloc>::multiset(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) multiset(_InputIterator __first, _InputIterator __last, ^ /usr/include/c++/4.8/bits/stl_multiset.h:176:9: note: template argument deduction/substitution failed: heap_sort.cpp:14:24: note: candidate expects 4 arguments, 1 provided multiset<int> s(1000005); ^ In file included from /usr/include/c++/4.8/set:62:0, from heap_sort.cpp:2: /usr/include/c++/4.8/bits/stl_multiset.h:160:9: note: template<class _InputIterator> std::multiset<_Key, _Compare, _Alloc>::multiset(_InputIterator, _InputIterator) multiset(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/4.8/bits/stl_multiset.h:160:9: note: template argument deduction/substitution failed: heap_sort.cpp:14:24: note: candidate expects 2 arguments, 1 provided multiset<int> s(1000005); ^ In file included from /usr/include/c++/4.8/set:62:0, from heap_sort.cpp:2: /usr/include/c++/4.8/bits/stl_multiset.h:146:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset(const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::allocator_type = std::allocator<int>] multiset(const _Compare& __comp, ^ /usr/include/c++/4.8/bits/stl_multiset.h:146:7: note: no known conversion for argument 1 from 'int' to 'const std::less<int>&' /usr/include/c++/4.8/bits/stl_multiset.h:137:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset() [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>] multiset() ^ /usr/include/c++/4.8/bits/stl_multiset.h:137:7: note: candidate expects 0 arguments, 1 provided
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Heap Sort 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ă.