#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
int n,m,a[100010];
priority_queue<int,vector<int>,greater<int> >Q;
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
for(int i=0;i<m;i++)Q.push(a[i]);
for(int i=m;i<n;i++){
Q.push(a[i]);
printf("%d\n",Q.top());
Q.pop();
}
while(!Q.empty()){
printf("%d\n",Q.top());
Q.pop();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1600 KB |
Output is correct |
2 |
Correct |
0 ms |
1600 KB |
Output is correct |
3 |
Correct |
0 ms |
1600 KB |
Output is correct |
4 |
Correct |
0 ms |
1600 KB |
Output is correct |
5 |
Correct |
0 ms |
1600 KB |
Output is correct |
6 |
Correct |
0 ms |
1600 KB |
Output is correct |
7 |
Correct |
0 ms |
1600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1600 KB |
Output is correct |
2 |
Correct |
0 ms |
1600 KB |
Output is correct |
3 |
Correct |
0 ms |
1600 KB |
Output is correct |
4 |
Correct |
0 ms |
1600 KB |
Output is correct |
5 |
Correct |
0 ms |
1600 KB |
Output is correct |
6 |
Correct |
0 ms |
1600 KB |
Output is correct |
7 |
Correct |
0 ms |
1600 KB |
Output is correct |
8 |
Correct |
0 ms |
1600 KB |
Output is correct |
9 |
Correct |
0 ms |
1600 KB |
Output is correct |
10 |
Correct |
0 ms |
1600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
1988 KB |
Output is correct |
2 |
Correct |
23 ms |
1600 KB |
Output is correct |
3 |
Correct |
54 ms |
1732 KB |
Output is correct |
4 |
Correct |
52 ms |
2372 KB |
Output is correct |
5 |
Correct |
40 ms |
1988 KB |
Output is correct |
6 |
Correct |
24 ms |
1600 KB |
Output is correct |
7 |
Correct |
59 ms |
1732 KB |
Output is correct |
8 |
Correct |
33 ms |
1600 KB |
Output is correct |
9 |
Correct |
40 ms |
1732 KB |
Output is correct |
10 |
Correct |
27 ms |
1600 KB |
Output is correct |
11 |
Correct |
44 ms |
1988 KB |
Output is correct |
12 |
Correct |
27 ms |
1600 KB |
Output is correct |
13 |
Correct |
45 ms |
1988 KB |
Output is correct |
14 |
Correct |
30 ms |
1600 KB |
Output is correct |
15 |
Correct |
27 ms |
1732 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
1732 KB |
Output is correct |
2 |
Correct |
0 ms |
1988 KB |
Output is correct |
3 |
Correct |
0 ms |
1600 KB |
Output is correct |
4 |
Correct |
46 ms |
1988 KB |
Output is correct |
5 |
Correct |
37 ms |
1732 KB |
Output is correct |
6 |
Correct |
0 ms |
1732 KB |
Output is correct |
7 |
Correct |
33 ms |
1732 KB |
Output is correct |
8 |
Correct |
32 ms |
1600 KB |
Output is correct |
9 |
Correct |
21 ms |
1600 KB |
Output is correct |
10 |
Correct |
47 ms |
1988 KB |
Output is correct |
11 |
Correct |
34 ms |
1988 KB |
Output is correct |
12 |
Correct |
14 ms |
1600 KB |
Output is correct |
13 |
Correct |
36 ms |
1600 KB |
Output is correct |
14 |
Correct |
42 ms |
2372 KB |
Output is correct |
15 |
Correct |
0 ms |
1600 KB |
Output is correct |