#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef pair<int,int>pill;
priority_queue <pill,vector<pill>,less<pill> > Q;
const int N=2e6+10;
int n,k,a[N];
int main()
{
cin>>n>>k;
for(int i=1;i<=n;i++)
{
cin>>a[i];
Q.push(mp(a[i],i));
if(i>=k)
{
while(Q.top().second<=i-k)Q.pop();
cout<<Q.top().first<<endl;
}
}
return 0;
}
STL大根堆小根堆
猜你喜欢
转载自blog.csdn.net/weixin_46001550/article/details/108600308
今日推荐
周排行