#include<cstdio>
#include<set>
int a,b,i,x[160001];
std::multiset<int>S;
std::multiset<int>::iterator t;
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++)
{
t=S.begin();
printf("%d ",*t);
S.erase(t);
if(i+b+1<a)S.insert(x[i+b+1]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1840 KB |
Output is correct |
2 |
Correct |
0 ms |
1840 KB |
Output is correct |
3 |
Correct |
0 ms |
1840 KB |
Output is correct |
4 |
Correct |
0 ms |
1840 KB |
Output is correct |
5 |
Correct |
0 ms |
1840 KB |
Output is correct |
6 |
Correct |
0 ms |
1840 KB |
Output is correct |
7 |
Correct |
0 ms |
1840 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1840 KB |
Output is correct |
2 |
Correct |
0 ms |
1840 KB |
Output is correct |
3 |
Correct |
0 ms |
1840 KB |
Output is correct |
4 |
Correct |
0 ms |
1840 KB |
Output is correct |
5 |
Correct |
0 ms |
1840 KB |
Output is correct |
6 |
Correct |
1 ms |
1840 KB |
Output is correct |
7 |
Correct |
0 ms |
1840 KB |
Output is correct |
8 |
Correct |
0 ms |
1840 KB |
Output is correct |
9 |
Correct |
0 ms |
1840 KB |
Output is correct |
10 |
Correct |
0 ms |
1840 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
72 ms |
4084 KB |
Output is correct |
2 |
Correct |
59 ms |
2896 KB |
Output is correct |
3 |
Correct |
33 ms |
2764 KB |
Output is correct |
4 |
Correct |
0 ms |
1840 KB |
Output is correct |
5 |
Correct |
78 ms |
6460 KB |
Output is correct |
6 |
Correct |
58 ms |
3160 KB |
Output is correct |
7 |
Correct |
21 ms |
1840 KB |
Output is correct |
8 |
Correct |
75 ms |
4612 KB |
Output is correct |
9 |
Correct |
0 ms |
1840 KB |
Output is correct |
10 |
Correct |
65 ms |
3424 KB |
Output is correct |
11 |
Correct |
39 ms |
1840 KB |
Output is correct |
12 |
Correct |
0 ms |
1840 KB |
Output is correct |
13 |
Correct |
37 ms |
2632 KB |
Output is correct |
14 |
Correct |
31 ms |
1840 KB |
Output is correct |
15 |
Correct |
50 ms |
3820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
1840 KB |
Output is correct |
2 |
Correct |
81 ms |
6460 KB |
Output is correct |
3 |
Correct |
42 ms |
1840 KB |
Output is correct |
4 |
Correct |
51 ms |
2632 KB |
Output is correct |
5 |
Correct |
39 ms |
1840 KB |
Output is correct |
6 |
Correct |
49 ms |
3424 KB |
Output is correct |
7 |
Correct |
56 ms |
3820 KB |
Output is correct |
8 |
Correct |
45 ms |
1840 KB |
Output is correct |
9 |
Correct |
72 ms |
4612 KB |
Output is correct |
10 |
Correct |
51 ms |
2896 KB |
Output is correct |
11 |
Correct |
76 ms |
4084 KB |
Output is correct |
12 |
Correct |
73 ms |
3160 KB |
Output is correct |
13 |
Correct |
40 ms |
2764 KB |
Output is correct |
14 |
Correct |
0 ms |
1840 KB |
Output is correct |
15 |
Correct |
41 ms |
1840 KB |
Output is correct |