Answer_Coarse @ 2020-06-10 21:20:11
后三个点re
#include<bits/stdc++.h>
using namespace std;
int n[50000001]={0},a,b,c,max1=0;
int main(){
cin>>a>>b;
for(int i=0;i<a;i++){
cin>>c;
n[c]++;
}
for(int i=0,j=0;i<50000001;i++){
if(n[i]!=0){
j+=n[i];
if(j>=b+1){
cout<<i;
return 0;
}
}
}
return 0;
}
by WanderingTrader @ 2020-06-10 21:22:13
@Answer_Coarse 这个用桶排不方便,直接打个sort就行了
by iMya_nlgau @ 2020-06-10 21:22:22
你用桶排?
by Semsue @ 2020-06-10 21:22:53
值域是1e9
by naroanah @ 2020-06-10 21:23:49
1e9用桶排?
by WanderingTrader @ 2020-06-10 21:23:51
@Sapphire6575737973 lztql
by PanH @ 2020-06-10 21:23:56
可以直接用nth_element @Answer_Coarse
by WanderingTrader @ 2020-06-10 21:24:12
作死也不能这样作吧