DaShabby @ 2022-03-09 20:49:05
#include<algorithm>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MaxN=5000005,MAX=1e7;
#define inf 0x7f7f7f7f
int sum[MAX];
int main()
{
int n,k;
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>sum[i];
}
sort(sum+1,sum+1+n,less<int>());
cout<<sum[k+1]<<endl;
return 0;
}```
by caramel_qwq @ 2022-03-09 20:51:37
请尽量使用 nth_element 来写本题,因为本题的重点在于练习分治算法
qwq
by 力巴尔 @ 2022-03-09 20:54:20
请自行查看题解
by 苏联小渣 @ 2022-03-09 21:05:49
@DaShabby sort
是