This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
priority_queue<int,vector<int>,greater<int> > q;
int main(){
int i,n,k,a;
scanf("%d%d",&n,&k);
for(i=1;i<=k;++i){
scanf("%d",&a);
q.push(a);
}
for(;i<=n;++i){
scanf("%d",&a);
q.push(a);
printf("%d ",q.top());
q.pop();
}
while(!q.empty())printf("%d ",q.top()),q.pop();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |