cheng110527 @ 2022-12-18 09:53:51
#include <iostream>
#include <algorithm>
using namespace std;
int a[5000005];
int main(){
int n,k;
cin >> n >> k;
for (int i = 1;i <= n;i++) cin >> a[i];
sort(a + 1,a + n + 1);
cout << a[++k];
return 0;
}
后两个测试点TLE
by liangbowen @ 2022-12-18 09:57:23
加快读,开O2。
by liangbowen @ 2022-12-18 09:57:53
时间复杂度更优的算法,请参考题解,会给你带来很大的帮助。
by cheng110527 @ 2023-01-06 20:54:02
@liangbowen 谢谢