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<iostream>
#include<queue>
#include<algorithm>
using namespace std;
int n,m,a[100010];
priority_queue<int,vector<int>,greater<int> >Q;
int main(){
ios::sync_with_stdio(0);
cin>>n>>m;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)Q.push(a[i]);
for(int i=m;i<n;i++){
Q.push(a[i]);
cout<<Q.top()<<" ";
Q.pop();
}
while(!Q.empty()){
cout<<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... |