#include<cstdio>
#include<set>
int a,b,i,x[160001];
std::multiset<int>S;
main()
{
scanf("%d%d",&a,&b);
for(i=0;i<a;i++)
{
scanf("%d",&x[i]);
if(i<=b)S.insert(x[i]);
}
for(i=0;i<a;i++)
{
printf("%d ",*S.begin());
S.erase(S.begin());
if(i+b+1<a)S.insert(x[i+b+1]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1836 KB |
Output is correct |
2 |
Correct |
0 ms |
1836 KB |
Output is correct |
3 |
Correct |
0 ms |
1836 KB |
Output is correct |
4 |
Correct |
0 ms |
1836 KB |
Output is correct |
5 |
Correct |
0 ms |
1836 KB |
Output is correct |
6 |
Correct |
0 ms |
1836 KB |
Output is correct |
7 |
Correct |
0 ms |
1836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1836 KB |
Output is correct |
2 |
Correct |
0 ms |
1836 KB |
Output is correct |
3 |
Correct |
0 ms |
1836 KB |
Output is correct |
4 |
Correct |
1 ms |
1836 KB |
Output is correct |
5 |
Correct |
0 ms |
1836 KB |
Output is correct |
6 |
Correct |
0 ms |
1836 KB |
Output is correct |
7 |
Correct |
0 ms |
1836 KB |
Output is correct |
8 |
Correct |
2 ms |
1836 KB |
Output is correct |
9 |
Correct |
0 ms |
1836 KB |
Output is correct |
10 |
Correct |
0 ms |
1836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
71 ms |
2628 KB |
Output is correct |
2 |
Correct |
0 ms |
1836 KB |
Output is correct |
3 |
Correct |
34 ms |
2760 KB |
Output is correct |
4 |
Correct |
50 ms |
2892 KB |
Output is correct |
5 |
Correct |
0 ms |
1836 KB |
Output is correct |
6 |
Correct |
64 ms |
3156 KB |
Output is correct |
7 |
Correct |
43 ms |
1836 KB |
Output is correct |
8 |
Correct |
62 ms |
3420 KB |
Output is correct |
9 |
Correct |
101 ms |
6456 KB |
Output is correct |
10 |
Correct |
37 ms |
1836 KB |
Output is correct |
11 |
Correct |
41 ms |
1836 KB |
Output is correct |
12 |
Correct |
48 ms |
3816 KB |
Output is correct |
13 |
Correct |
68 ms |
4608 KB |
Output is correct |
14 |
Correct |
40 ms |
1836 KB |
Output is correct |
15 |
Correct |
81 ms |
4080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
65 ms |
3156 KB |
Output is correct |
2 |
Correct |
65 ms |
3420 KB |
Output is correct |
3 |
Correct |
68 ms |
4080 KB |
Output is correct |
4 |
Correct |
0 ms |
1836 KB |
Output is correct |
5 |
Correct |
37 ms |
1836 KB |
Output is correct |
6 |
Correct |
55 ms |
2760 KB |
Output is correct |
7 |
Correct |
74 ms |
2628 KB |
Output is correct |
8 |
Correct |
83 ms |
6456 KB |
Output is correct |
9 |
Correct |
0 ms |
1836 KB |
Output is correct |
10 |
Correct |
0 ms |
1836 KB |
Output is correct |
11 |
Correct |
82 ms |
4608 KB |
Output is correct |
12 |
Correct |
13 ms |
1836 KB |
Output is correct |
13 |
Correct |
34 ms |
1836 KB |
Output is correct |
14 |
Correct |
35 ms |
2892 KB |
Output is correct |
15 |
Correct |
52 ms |
3816 KB |
Output is correct |