#180
sortMinMax
Să se ordoneze crescător elementele dintr-un şir dat cuprinse între elementul de valoare maximă şi cel de valoare minimă.
Problema | sortMinMax | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57513846 | Utilizator | |
Fișier | sortminmax.cpp | Dimensiune | 1.15 KB |
Data încărcării | 02 Aprilie 2025, 23:05 | Scor / rezultat | Eroare de compilare |
sortminmax.cpp: In function 'std::vector<int> sort_between_min_max(std::vector<int>)': sortminmax.cpp:20:54: error: 'min_element' was not declared in this scope int min_val = *min_element(arr.begin(), arr.end()); ^ sortminmax.cpp:21:54: error: 'max_element' was not declared in this scope int max_val = *max_element(arr.begin(), arr.end()); ^ sortminmax.cpp:22:55: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)' int min_idx = find(arr.begin(), arr.end(), min_val) - arr.begin(); ^ sortminmax.cpp:22:55: note: candidate is: In file included from /usr/include/c++/4.8/bits/locale_facets.h:48:0, from /usr/include/c++/4.8/bits/basic_ios.h:37, from /usr/include/c++/4.8/ios:44, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortminmax.cpp:1: /usr/include/c++/4.8/bits/streambuf_iterator.h:369:5: note: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&) find(istreambuf_iterator<_CharT> __first, ^ /usr/include/c++/4.8/bits/streambuf_iterator.h:369:5: note: template argument deduction/substitution failed: sortminmax.cpp:22:55: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>' int min_idx = find(arr.begin(), arr.end(), min_val) - arr.begin(); ^ sortminmax.cpp:23:55: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)' int max_idx = find(arr.begin(), arr.end(), max_val) - arr.begin(); ^ sortminmax.cpp:23:55: note: candidate is: In file included from /usr/include/c++/4.8/bits/locale_facets.h:48:0, from /usr/include/c++/4.8/bits/basic_ios.h:37, from /usr/include/c++/4.8/ios:44, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortminmax.cpp:1: /usr/include/c++/4.8/bits/streambuf_iterator.h:369:5: note: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&) find(istreambuf_iterator<_CharT> __first, ^ /usr/include/c++/4.8/bits/streambuf_iterator.h:369:5: note: template argument deduction/substitution failed: sortminmax.cpp:23:55: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>' int max_idx = find(arr.begin(), arr.end(), max_val) - arr.begin(); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sortMinMax 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ă.