一、设计特殊样例+常规样例

3333
41314

二、AC代码

#include<bits/stdc++.h>
using namespace std;

int n,k;
vector<int> solve;
int main()
{
    while( ~scanf("%d%d",&n, &k) )
    {
        solve.resize(n);
        for(int i=0; i<n; ++i)
        {
            scanf("%d",&solve[i]);
        }
        vector<int> Help(n);
        copy( solve.begin(), solve.end(), Help.begin() );

        make_heap( solve.begin(), solve.end() );
        sort_heap( solve.begin(), solve.end() );

        unordered_map<int,int> mp;
        for(int i=0; i<k; ++i)
        {
            mp[ solve[i] ]++;
        }


        for( auto num : Help )
        {
            if( !k )
            {
                break;
            }
            if( mp[num]>0 )
            {
                printf("%d\n", num );
                --k;
            }
        }

    }

    return 0;
}