#1157
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 |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64346511 | Utilizator | |
| Fișier | ksort2.cpp | Dimensiune | 1.12 KB |
| Data încărcării | 30 Aprilie 2026, 19:27 | Scor/rezultat | 20 puncte |
ksort2.cpp: In function ‘int pivot1(int, int)’: ksort2.cpp:10:9: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation] 10 | while(st<dr && v[dr]>=aux) | ^~~~~ ksort2.cpp:12:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’ 12 | v[st]=v[dr]; | ^ ksort2.cpp: In function ‘void quicksort1(int, int)’: ksort2.cpp:24:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 24 | if(st<m) | ^~ ksort2.cpp:26:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 26 | if(m<dr) | ^~ ksort2.cpp: In function ‘int pivot(int, int)’: ksort2.cpp:34:9: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation] 34 | while(st<dr && v[dr]<=aux) | ^~~~~ ksort2.cpp:36:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’ 36 | v[st]=v[dr]; | ^ ksort2.cpp: In function ‘void quicksort(int, int)’: ksort2.cpp:48:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 48 | if(st<m) | ^~ ksort2.cpp:50:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 50 | if(m<dr) | ^~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.003 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.002 secunde | Caught fatal signal 11 | 40 | 0 | ||
| 3 | 0.003 secunde | Caught fatal signal 11 | 40 | 0 | ||
| Punctaj total | 20 | |||||
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ă.