```cpp
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
int f[10000][10000];
int main(){
int i,j,m,n,begin,end;
scanf("%d%d",&m,&n);
for(i=1;i<=m;i++)scanf("%d",&f[i][i]);
for(i=1;i<=m;i++)
for(j=i+1;j<=m;j++)
f[i][j]=min(f[i][j-1],f[j][j]);
while(n--){
scanf("%d%d",&begin,&end);
printf("%d ",f[begin][end]);
}
return 0;
}
```
by the_writer @ 2017-11-04 23:45:19
看到f数组和区间dp,
建议:st表
(滑稽)(笑哭)
by OIer991215 @ 2017-11-05 00:07:10
把dp的第二维改成倍增式
然后你就自学成功了st表
by Night_Aurora @ 2017-11-05 08:25:42