SIXIANG32 @ 2020-03-30 10:03:07
#include<iostream>
using namespace std;
bool flag[100000000];
int a;
int main()
{
int n,k,y=-1,min=100000000,max=0;
cin>>n>>k;
for(int p=1;p<=n;p++)
{
cin>>a;
flag[a]=0;
if(a<min)min=a;
if(a>max)max=a;
}
for(int p=min;p<=n;p++)
{
if(flag[p]==0)
y++;
if(y==k)
{
cout<<p<<endl;
return 0;
}
}
}
救救我吧qwqqAq
by tangrunxi @ 2020-03-30 10:16:35
@liqingyang 因为你调用了STL里的nth_element
by liqingyang @ 2020-03-30 10:17:14
@tangrunxi 不,原来没有,原来的评测是sort过的!
by duyh1114 @ 2020-03-30 10:17:39
@liqingyang 不用氧气会T
by liqingyang @ 2020-03-30 10:17:49
@duyh1114 对滴
by duyh1114 @ 2020-03-30 10:18:34
反正stl就这个特性
by liqingyang @ 2020-03-30 10:20:03
@duyh1114 现在我过了,用正常的方法过了
by liqingyang @ 2020-03-30 10:25:53
算了算了,就这样吧,我优化不了了!
by SIXIANG32 @ 2020-03-30 10:26:18
scanf+printf+o2+sort即可水过 @liqingyang @tangrunxi
by liqingyang @ 2020-03-30 10:27:27
@SIXIANG 您这个不行,我水过了都还用STL另一个函数再水了一遍
by liqingyang @ 2020-03-30 10:27:55
@SIXIANG 我不开O2都比你快。。。