表示我就看到了桶排序;

#include<bits/stdc++.h>
using namespace std;
inline int read(){    int x = 0, f = 1;    char ch = getchar();    while(ch < '0' || ch > '9'){        if (ch == '-')            f = -1;        ch = getchar();    }    while(ch >= '0' && ch <= '9'){        x = (x<<1) + (x<<3) + (ch^48);        ch = getchar();    }    return x * f;}
int main()
{
    int a[8100000];
    int t,n;
    t=read();
    while(t--)
    {
        n=read();
        int max1=0;
        memset(a,0,sizeof(a));
        int k=read();
        for(int i=1;i<=n;i++) 
        {
           int h;h=read();
            a[h]++;max1=max(max1,h);
        }
        int i=0;
        for(int l=0;l<=max1;l++)
        {
            if(a[l]) {
                if(i<k&&(i+a[l]>=k)){
                    printf("%d\n",l);break;
                }
                i+=a[l];
            }
        }
    }
}