#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1720 KB |
Output is correct |
2 |
Correct |
0 ms |
1720 KB |
Output is correct |
3 |
Correct |
0 ms |
1720 KB |
Output is correct |
4 |
Correct |
0 ms |
1720 KB |
Output is correct |
5 |
Correct |
0 ms |
1720 KB |
Output is correct |
6 |
Correct |
0 ms |
1720 KB |
Output is correct |
7 |
Correct |
0 ms |
1720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1720 KB |
Output is correct |
2 |
Correct |
0 ms |
1720 KB |
Output is correct |
3 |
Correct |
0 ms |
1720 KB |
Output is correct |
4 |
Correct |
0 ms |
1720 KB |
Output is correct |
5 |
Correct |
0 ms |
1720 KB |
Output is correct |
6 |
Correct |
0 ms |
1720 KB |
Output is correct |
7 |
Correct |
1 ms |
1720 KB |
Output is correct |
8 |
Correct |
1 ms |
1720 KB |
Output is correct |
9 |
Correct |
0 ms |
1720 KB |
Output is correct |
10 |
Correct |
0 ms |
1720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
1720 KB |
Output is correct |
2 |
Correct |
60 ms |
1852 KB |
Output is correct |
3 |
Correct |
46 ms |
2108 KB |
Output is correct |
4 |
Correct |
46 ms |
1720 KB |
Output is correct |
5 |
Correct |
41 ms |
2108 KB |
Output is correct |
6 |
Correct |
41 ms |
1852 KB |
Output is correct |
7 |
Correct |
33 ms |
1852 KB |
Output is correct |
8 |
Correct |
41 ms |
1720 KB |
Output is correct |
9 |
Correct |
36 ms |
1720 KB |
Output is correct |
10 |
Correct |
63 ms |
1720 KB |
Output is correct |
11 |
Correct |
0 ms |
1720 KB |
Output is correct |
12 |
Correct |
49 ms |
2492 KB |
Output is correct |
13 |
Correct |
55 ms |
2108 KB |
Output is correct |
14 |
Correct |
46 ms |
2108 KB |
Output is correct |
15 |
Correct |
56 ms |
1852 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
1720 KB |
Output is correct |
2 |
Correct |
36 ms |
1720 KB |
Output is correct |
3 |
Correct |
18 ms |
1720 KB |
Output is correct |
4 |
Correct |
38 ms |
2492 KB |
Output is correct |
5 |
Correct |
56 ms |
1720 KB |
Output is correct |
6 |
Correct |
0 ms |
1852 KB |
Output is correct |
7 |
Correct |
27 ms |
2108 KB |
Output is correct |
8 |
Correct |
40 ms |
1852 KB |
Output is correct |
9 |
Correct |
33 ms |
2108 KB |
Output is correct |
10 |
Correct |
38 ms |
2108 KB |
Output is correct |
11 |
Correct |
45 ms |
1852 KB |
Output is correct |
12 |
Correct |
43 ms |
1720 KB |
Output is correct |
13 |
Correct |
37 ms |
1852 KB |
Output is correct |
14 |
Correct |
29 ms |
2108 KB |
Output is correct |
15 |
Correct |
52 ms |
1720 KB |
Output is correct |