Substitute0329 @ 2018-11-15 13:57:11
#include<iostream>
using namespace std;
int n,m;
int a[2000001]={0},minn;
int main(){
cin>>n>>m;
for(long i=1;i<=n;i++)cin>>a[i];
for(long i=1;i<=n;i++)
{
if(i==1){
cout<<"0"<<endl;
continue;
}
minn=0x7fffffff;
for(int j=i-1;j>=i-m;j--){
if(j>=1)
if(minn>a[j])minn=a[j];
}
cout<<minn<<endl;
}
return 0;
}
by mcyqwq @ 2018-11-15 13:58:49
@情谊、暴走 要是能暴力就不是黄题了
by Aja_hb @ 2018-11-15 14:50:24
n方过百万?(cin跑2e6怕不是要一万年qwq
by X_WT @ 2018-12-05 19:40:25
by yurzhang @ 2019-01-04 16:04:57
你可以试试线段树。。
594ms
by ArachnidaKing @ 2019-01-09 11:23:31
打败cint党!!QwQ