用一下小堆 #include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>n>>k; priority_queue<int,vector,greater<>>q; for(int i=0;i<=n;i++){ int temp; scanf("%d",&temp); q.push(temp); } while(k--){ int res=q.top(); cout<<res<<" "; q.pop(); } retur...