Miracle516 @ 2021-06-20 10:24:16
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int n,i;
scanf("%d%d",&n,&i);
int a[n];
for(int j = 0; j < n; j++){
scanf("%d",&a[j]);
}
sort(a,a + n);
printf("%d",a[i]);
return 0;
}
by zhangruozhong @ 2021-06-20 10:31:47
#include<bits/stdc++.h>
using namespace std;
long long n,k,a[5000010];
int main()
{
scanf("%d%d",&n,&k);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
nth_element(a,a+k,a+n);
printf("%d",a[k]);
}
by Sliarae @ 2021-06-20 11:54:08
@胡昊明516
和我错误一样(捂脸)
用nth_element()好像快一些
by Axecay @ 2021-07-17 21:20:46
.............. 不开O2总是60, 开了O2AC是什么鬼