CSP_Sept @ 2020-02-13 11:08:14
#include <bits/stdc++.h>
using namespace std;
int tmp,minn,minx,flag=0,n,m,bef;
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
scanf("%d",&tmp);
if(!flag){
minn=tmp;
minx=1;
flag=1;
}
else if(bef<=minn||minx+m<i){//更小或超过则更新
minn=bef;
minx=i-1;
}
if(i==1) printf("0\n");
else printf("%d\n",minn);
bef=tmp;
}
return 0;
}
by __gcd @ 2020-02-13 11:10:38
@CSP_Sept 这题不是ST表吗(超恶心的还要滚动数组)
by Asuna_Eternity @ 2020-02-13 11:11:21
@一只大头 我用单调对联过得啊
by Asuna_Eternity @ 2020-02-13 11:11:37
不过确实要用滚动数组
by CSP_Sept @ 2020-02-13 11:16:48
@Asuna_Eternity @一只大头 那按照我的方法能做吗?
by Asuna_Eternity @ 2020-02-13 11:17:55
@CSP_Sept 稍等我在看
by Asuna_Eternity @ 2020-02-13 11:18:19
@CSP_Sept 您可以解释一下minx的作用么
by CSP_Sept @ 2020-02-13 11:19:03
@Asuna_Eternity 记录下标
by Asuna_Eternity @ 2020-02-13 11:19:23
@CSP_Sept 嗯好的谢谢
by Aehnuwx @ 2020-02-13 11:23:34
@一只大头 单调队列就行了吧
by Asuna_Eternity @ 2020-02-13 11:28:18
@CSP_Sept 看了一下,您的解法会导致