#1157
KSort2
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.
Pentru sortare se va folosit metoda QuickSort sau MergeSort.
Problema | KSort2 | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #55672586 | Utilizator | |
Fișier | ksort2.cpp | Dimensiune | 980 B |
Data încărcării | 22 Ianuarie 2025, 09:45 | Scor / rezultat | Eroare de compilare |
ksort2.cpp: In function 'int quick1(int, int)': ksort2.cpp:10:17: error: request for member 'h' in 'a[i]', which is of non-class type 'int' if(a[i].h>a[j].h) ^ ksort2.cpp:10:24: error: request for member 'h' in 'a[j]', which is of non-class type 'int' if(a[i].h>a[j].h) ^ ksort2.cpp: In function 'int DEI1(int, int)': ksort2.cpp:29:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ ksort2.cpp: In function 'int quick2(int, int)': ksort2.cpp:35:17: error: request for member 'h' in 'a[i]', which is of non-class type 'int' if(a[i].h<a[j].h) ^ ksort2.cpp:35:24: error: request for member 'h' in 'a[j]', which is of non-class type 'int' if(a[i].h<a[j].h) ^ ksort2.cpp: In function 'int DEI2(int, int)': ksort2.cpp:54:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ ksort2.cpp: In function 'int main()': ksort2.cpp:59:15: error: request for member 'h' in 'a[i]', which is of non-class type 'int' cin>>a[i].h; ^ ksort2.cpp:63:16: error: request for member 'h' in 'a[i]', which is of non-class type 'int' cout<<a[i].h<<" "; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema KSort2 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ă.