#511
KSort
Se dă un vector cu n
elemente, numere naturale și un număr k
. Ordonați crescător primele k
elemente ale vectorului și descrescător ultimele n-k
elemente.
Problema | KSort | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54195955 | Utilizator | |
Fișier | ksort.cpp | Dimensiune | 537 B |
Data încărcării | 21 Noiembrie 2024, 20:12 | Scor / rezultat | Eroare de compilare |
ksort.cpp: In function 'int main()': ksort.cpp:26:20: error: no matching function for call to 'sort(int, int&, int [1001], int)' sort(1, k, v, 1); ^ ksort.cpp:26:20: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:62:0, from ksort.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:5447:5: note: template<class _RAIter> void std::sort(_RAIter, _RAIter) sort(_RandomAccessIterator __first, _RandomAccessIterator __last) ^ /usr/include/c++/4.8/bits/stl_algo.h:5447:5: note: template argument deduction/substitution failed: ksort.cpp:26:20: note: candidate expects 2 arguments, 4 provided sort(1, k, v, 1); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from ksort.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:5483:5: note: template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare) sort(_RandomAccessIterator __first, _RandomAccessIterator __last, ^ /usr/include/c++/4.8/bits/stl_algo.h:5483:5: note: template argument deduction/substitution failed: ksort.cpp:26:20: note: candidate expects 3 arguments, 4 provided sort(1, k, v, 1); ^ ksort.cpp:27:22: error: no matching function for call to 'sort(int, int&, int [1001], int)' sort(k+1, n, v, 0); ^ ksort.cpp:27:22: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:62:0, from ksort.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:5447:5: note: template<class _RAIter> void std::sort(_RAIter, _RAIter) sort(_RandomAccessIterator __first, _RandomAccessIterator __last) ^ /usr/include/c++/4.8/bits/stl_algo.h:5447:5: note: template argument deduction/substitution failed: ksort.cpp:27:22: note: candidate expects 2 arguments, 4 provided sort(k+1, n, v, 0); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from ksort.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h:5483:5: note: template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare) sort(_RandomAccessIterator __first, _RandomAccessIterator __last, ^ /usr/include/c++/4.8/bits/stl_algo.h:5483:5: note: template argument deduction/substitution failed: ksort.cpp:27:22: note: candidate expects 3 arguments, 4 provided sort(k+1, n, v, 0); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema KSort 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ă.