Using divide-and-conquer algorithm to find the number with large k

given an array, count the first k large numbers and output the k numbers from large to small.

enter
the first line contains an integer n that represents the size of the array. N < 100000. The second line of
contains n integers, representing the elements of the array, separated by a space. The absolute value of each integer does not exceed 100000000. The third line of
contains an integer k. K < n.
output
output the first k large numbers from large to small, one line each.
sample input
10
4 56 9 8 7 1 2 30
5
sample output
9
8
7
6
5
my code is as follows

< H1 > include < iostream > < / H1 >

using namespace std;

int a [100010];

void swap (int & a, int & b) / / Exchange variable a, b value
{

int tmp = a;
a = b;
b = tmp;

}
void print (int a [], int s, int e) {/ / output array s to e items

for (int i = 1; i < (e - s)+1; iPP)
    cout << a[s + i] <<endl;

}
void arrange (int a [], int s, int epenint k) {

if (s >= e) return;
int m= a[s];
int i = s, j = e;
while (i != j) {
    while (j > i&&a[j] >= m) {            //mm
        --j;
    }
    swap(a[i], a[j]);
    while (j > i&&a[i] <= m)
        PPi;
    swap(a[i], a[j]);
}
if ((e - j) == k) print(a, j, e);       //mk
if ((e - j) > k)   arrange(a, j, e, k);    //karrange
if ((e - j) < k) arrange(a, s, j, e-j - k); //karrange

}

int main () {

int n;
cin >> n;
for (int i = 0; i < n; iPP)
    cin >> a[i];
int k;
cin >> k;
arrange(a, 0, n - 1, k);
return 0;

}
sample output is correct, but the online submission is wrong, and it should be timed out. Maybe big data my program will not work, ask for advice

C cPP
Jul.30,2021

this problem cannot be done by divide and conquer, and the number that is big (small) before K should be done by heap sort. Refer to https://blog.csdn.net/hanjing.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4648e-44b99.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4648e-44b99.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?