-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11003.cpp
More file actions
25 lines (23 loc) · 501 Bytes
/
11003.cpp
File metadata and controls
25 lines (23 loc) · 501 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <queue>
#include <functional>
using namespace std;
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
int N, L;
cin >> N >> L;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
for (int i = 0; i < N; i++)
{
int a;
cin >> a;
pq.push({a, i});
while (pq.top().second + L <= i)
pq.pop();
cout << pq.top().first << " ";
}
return 0;
}