Obscurity @ 2018-10-22 14:10:37
#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
int q1[1000001],q2[1000001];
int a[1000001];
void mins()
{
int h=1,t=0,sb=1;
for(int i=1;i<=n;i++)
{
while(h<=t&&q1[h]+m<=i) h++;
while(h<=t&&a[i]<a[q1[t]])t--;
q1[++t]=i;
if(sb!=n)
printf("%d\n",a[q1[h]]),sb++;
}
return ;
}
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>a[i];
cout<<0<<endl;
mins();
return 0;
}
by Karlis @ 2018-10-22 14:40:55
@潇洒却安逸
数组开小了吧,而且cin不关同步的话很慢
by Obscurity @ 2018-10-23 13:43:23
@Karlis 忘记看数组了。。。谢谢啊