20110915_260 @ 2023-07-22 09:13:45
#include<iostream>
#include<algorithm>
using namespace std;
int a[5000005],n,m;
int main(){
cin>>m>>n;
for(int i=0;i<m;i++)
cin>>a[i];
sort(a,a+m);
cout<<a[n];
return 0;
}
by JACK2021 @ 2023-07-22 09:38:21
O(n log2 n2)不一定能,过时间复杂度太高,建议桶排序,或者手写。
by _ZXWDS @ 2023-07-22 09:39:08
看看数据范围(笑
by melting_moon @ 2023-07-22 13:19:56
开O2即可
by chen_z @ 2023-07-24 13:52:35
@JACK2021 这题真的能桶排吗?
by chen_z @ 2023-07-24 13:56:00
@melting_moon 开O2还是会T两个点
by chen_z @ 2023-07-24 14:26:01
@melting_moon 主要是scanf
by melting_moon @ 2023-07-24 17:29:52
我开了O2和ios::sync_with_stdio(false)和cin.tie(0)就用内置sort过掉了...
by jzl15880255743 @ 2023-08-02 13:48:18
@20110915_260 用桶排
by 20110915_260 @ 2023-08-03 09:07:25
@jzl15880255743 栓Q辣
by 20110915_260 @ 2023-08-03 09:08:58
@jzl15880255743 不过只用开O2。