Oye0ye @ 2022-06-02 13:27:47
#include<bits/stdc++.h>
using namespace std;
int c,n,m,j,i,t[2000001];
int main()
{
cin>>m>>n;
c=n-1;
for(i=1;i<=m;i++)
{
cin>>t[i];
}
sort(t+1,t+m+1);
for(i=1;i<m;i++)
{
if(t[i]==t[i+1])
c++;
}
cout<<t[1+n];
}
by SegTree @ 2022-06-02 13:53:49
数组开小了
1\leq n<5\times 10^6
by SegTree @ 2022-06-02 13:54:03
@oyeoye
by _cyle_King @ 2022-06-02 13:56:42
错了,是
by _cyle_King @ 2022-06-02 13:58:20
还有,这题不能用cin,不然会超时。
by _cyle_King @ 2022-06-02 14:12:17
貌似直接排序的话,卡常卡的好可以卡过去。
AC代码:[https://www.luogu.com.cn/paste/6902rjy1]()
by Oye0ye @ 2022-06-06 12:41:46
谢谢