wczxluo @ 2023-07-26 15:14:25
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[500001];
int n;int m;
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+n);
cout<<a[m];
return 0;
}
by Henry2012 @ 2023-07-26 15:21:01
数组开小了
by Henry2012 @ 2023-07-26 15:21:42
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[5000001];
int n;int m;
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+n);
cout<<a[m];
return 0;
}
by Henry2012 @ 2023-07-26 15:22:28
不过改了也会TLE,这题要用
by __ii__ @ 2023-07-26 15:41:13
用分治试下。
by IAKIOI123 @ 2023-08-03 12:09:12
开O2就好了