#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
int n,m;
priority_queue<int,vector<int>,greater<int> > pq;
int main(){
int i,a;
scanf("%d %d",&n,&m); if(m>=n) m--;
for(i=0;i<=m;i++) scanf("%d",&a),pq.push(a);
for(i=m+1;i<n;i++){
printf("%d ",pq.top()); pq.pop(); scanf("%d",&a); pq.push(a);
}
while(!pq.empty()) printf("%d ",pq.top()),pq.pop();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1208 KB |
Output is correct |
2 |
Correct |
0 ms |
1208 KB |
Output is correct |
3 |
Correct |
0 ms |
1208 KB |
Output is correct |
4 |
Correct |
0 ms |
1208 KB |
Output is correct |
5 |
Correct |
0 ms |
1208 KB |
Output is correct |
6 |
Correct |
0 ms |
1208 KB |
Output is correct |
7 |
Correct |
0 ms |
1208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1208 KB |
Output is correct |
2 |
Correct |
0 ms |
1208 KB |
Output is correct |
3 |
Correct |
1 ms |
1208 KB |
Output is correct |
4 |
Correct |
0 ms |
1208 KB |
Output is correct |
5 |
Correct |
0 ms |
1208 KB |
Output is correct |
6 |
Correct |
0 ms |
1208 KB |
Output is correct |
7 |
Correct |
0 ms |
1208 KB |
Output is correct |
8 |
Correct |
0 ms |
1208 KB |
Output is correct |
9 |
Correct |
0 ms |
1208 KB |
Output is correct |
10 |
Correct |
0 ms |
1208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1596 KB |
Output is correct |
2 |
Correct |
38 ms |
1208 KB |
Output is correct |
3 |
Correct |
35 ms |
1208 KB |
Output is correct |
4 |
Correct |
0 ms |
1340 KB |
Output is correct |
5 |
Correct |
26 ms |
1208 KB |
Output is correct |
6 |
Correct |
38 ms |
1596 KB |
Output is correct |
7 |
Correct |
34 ms |
1208 KB |
Output is correct |
8 |
Correct |
48 ms |
1596 KB |
Output is correct |
9 |
Correct |
44 ms |
1340 KB |
Output is correct |
10 |
Correct |
0 ms |
1980 KB |
Output is correct |
11 |
Correct |
29 ms |
1596 KB |
Output is correct |
12 |
Correct |
37 ms |
1340 KB |
Output is correct |
13 |
Correct |
38 ms |
1208 KB |
Output is correct |
14 |
Correct |
20 ms |
1208 KB |
Output is correct |
15 |
Correct |
31 ms |
1340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
1208 KB |
Output is correct |
2 |
Correct |
35 ms |
1340 KB |
Output is correct |
3 |
Correct |
48 ms |
1596 KB |
Output is correct |
4 |
Correct |
61 ms |
1596 KB |
Output is correct |
5 |
Correct |
0 ms |
1208 KB |
Output is correct |
6 |
Correct |
0 ms |
1208 KB |
Output is correct |
7 |
Correct |
0 ms |
1340 KB |
Output is correct |
8 |
Correct |
45 ms |
1340 KB |
Output is correct |
9 |
Correct |
25 ms |
1208 KB |
Output is correct |
10 |
Correct |
17 ms |
1596 KB |
Output is correct |
11 |
Correct |
46 ms |
1340 KB |
Output is correct |
12 |
Correct |
49 ms |
1980 KB |
Output is correct |
13 |
Correct |
0 ms |
1596 KB |
Output is correct |
14 |
Correct |
0 ms |
1208 KB |
Output is correct |
15 |
Correct |
25 ms |
1208 KB |
Output is correct |