顾士博 @ 2018-11-01 11:40:39
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int n,m,mi[1000010],a[1000010],q[1000011];int f[1000010],mii=0x3ffff,h=1,t;
int re()
{
char ch=getchar(); int x=0;
while(ch<'0'||ch>'9') ch=getchar();
while(ch<='9'&&ch>='0') x=x*10+ch-'0',ch=getchar();
return x;
}
int main()
{
n=re(); m=re();
for(int i=1;i<=n;i++)
a[i]=re();
if(m>=n)
{
for(int i=1;i<=n;i++)
{
mii=min(mii,a[i]);
printf("%d\n",mii);
}
return 0;
}
for(int i=1;i<=n;i++)
{
printf("%d\n",q[h]);
while(h<=t&&q[t]>=a[i]) t--;
q[++t]=a[i]; f[t]=i;
while(i-m>=f[h]) ++h;
}
return 0;
}
by d3NtMDAw @ 2018-11-01 12:29:49
你这个编译都通不过啊
by X_WT @ 2018-12-05 20:29:59