44i11 @ 2022-12-09 12:46:19
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a[2500000],k;
cin>>n>>k;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
cout<<a[k];
}
by Zsyxing @ 2022-12-09 12:57:21
long long n,a[5000000],k;TLE用二分/STL
by Zsyxing @ 2022-12-09 12:58:29
@0627Xx
by 44i11 @ 2022-12-09 12:58:36
@Zsyxing ,具体怎么做?
by Zsyxing @ 2022-12-09 12:59:35
看题解,里面说的很清楚
by 44i11 @ 2022-12-09 13:00:31
@Cxy020202 ,开大了TLE。
by Cxy020202 @ 2022-12-09 13:04:24
@0627Xx \
用scanf然后开O2
by Destinyle @ 2022-12-09 13:10:42
用 nth_element,用来将数组元素中第k小的整数排出来,时间复杂度