deamoon_2 @ 2019-08-09 22:21:44
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[2000001],l=1,r=0,q[2000001];
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=n;i++)
{
cout<<a[q[l]]<<endl;
if(i-q[l]+1>m&&l<=r)
l++;
while(a[i]<a[q[r]]&&l<=r)
r--;
q[++r]=i;
}
return 0;
}
by 蒟蒻365 @ 2019-08-09 22:29:53
@老俊 不要用cin,换成快读或者scanf