#include <cstdio>
#include <queue>
using namespace std;
int n,k,buf;
priority_queue<int> pq;
queue<int> q;
int main()
{
scanf("%d%d",&n,&k);
for(int i=0;i<=k && i<n;++i) scanf("%d",&buf), pq.push(-buf);
for(;pq.size();){
printf("%d ",-pq.top()); pq.pop();
if(scanf("%d",&buf)==1) pq.push(-buf);
}
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 |
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 |
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 |
24 ms |
1208 KB |
Output is correct |
2 |
Correct |
41 ms |
1208 KB |
Output is correct |
3 |
Correct |
13 ms |
1208 KB |
Output is correct |
4 |
Correct |
287 ms |
1980 KB |
Output is correct |
5 |
Correct |
133 ms |
1596 KB |
Output is correct |
6 |
Correct |
117 ms |
1340 KB |
Output is correct |
7 |
Correct |
64 ms |
1340 KB |
Output is correct |
8 |
Correct |
36 ms |
1208 KB |
Output is correct |
9 |
Correct |
69 ms |
1340 KB |
Output is correct |
10 |
Correct |
146 ms |
1596 KB |
Output is correct |
11 |
Correct |
0 ms |
1208 KB |
Output is correct |
12 |
Correct |
139 ms |
1596 KB |
Output is correct |
13 |
Correct |
69 ms |
1340 KB |
Output is correct |
14 |
Correct |
186 ms |
1596 KB |
Output is correct |
15 |
Correct |
28 ms |
1208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1208 KB |
Output is correct |
2 |
Correct |
30 ms |
1208 KB |
Output is correct |
3 |
Correct |
0 ms |
1208 KB |
Output is correct |
4 |
Correct |
35 ms |
1208 KB |
Output is correct |
5 |
Correct |
179 ms |
1596 KB |
Output is correct |
6 |
Correct |
243 ms |
1596 KB |
Output is correct |
7 |
Correct |
55 ms |
1340 KB |
Output is correct |
8 |
Correct |
251 ms |
1980 KB |
Output is correct |
9 |
Correct |
129 ms |
1596 KB |
Output is correct |
10 |
Correct |
118 ms |
1596 KB |
Output is correct |
11 |
Correct |
93 ms |
1340 KB |
Output is correct |
12 |
Correct |
318 ms |
1340 KB |
Output is correct |
13 |
Correct |
0 ms |
1208 KB |
Output is correct |
14 |
Correct |
0 ms |
1208 KB |
Output is correct |
15 |
Correct |
69 ms |
1340 KB |
Output is correct |