ST表模板

####ST表用来求给定区间RMQ的最值
st[i][j] 表示以i开头i+2^j结尾的区间的最值。
初态:st[i][0] = a[i];
状态转移: st[i][j] = min/max (st[i][j-1], st[i+(1<<(j-1))][j-1]);
模板

const int maxn = 1005;
int stmin[maxn][20],stmax[maxn][20];
void InitSt()
{
    for(int j=1; (1<

练习题 : HDU OJ 3183

你可能感兴趣的:(数据结构)