Auintpa @ 2018-10-16 21:11:43
st表M,线段树T,我该怎么办...QWQ
by cosmicAC @ 2018-10-16 21:14:03
zkw?
by A星际穿越 @ 2018-10-16 21:14:34
st表M?你的打法有问题
by 星小雨 @ 2018-10-16 21:14:42
st写错了吧
by 小粉兔 @ 2018-10-16 21:16:14
用暴力分块。
by GKxx @ 2018-10-16 21:20:35
我zkw线段树过了这题
by Episode9 @ 2018-10-16 21:22:57
dddl
by BuXiangJuanLe @ 2018-10-18 15:08:23
@GKxx GKORZ
by mureZ @ 2018-11-01 18:21:59
同求st MLE
#include <iostream>
#define N 2000005
using namespace std;
short log2[N];
int n,m;
void init(){
for (int i=2;i<=n;i++)
log2[i]=log2[i>>1]+1;
}
int a[N],f[N][30],l,r;
int main(){
cin>>n>>m;
log2[0]=-1;
for (int i=1;i<=n;i++){
cin>>a[i];
f[i][0]=a[i];
log2[i]=log2[i>>1]+1;
}
for (int j=1;j<=25;j++){
for (int i=1;i+(1<<j)-1<=n;i++){
f[i][j]=min(f[i][j-1],f[i+(1<<j-1)][j-1]);
}
}
cout<<0<<endl;
for (int i=2;i<=n;i++){
l=max(1,i-m);
r=i-1;
cout<<min(f[l][log2[r-l+1]],f[r-(1<<log2[r-l+1])+1][log2[r-l+1]])<<endl;
}
return 0;
}