以前用RMQ做过,刚好最近在做线段树,就用线段树也做了下,1A~两个域,分别保存当前结点下面的最大值和最小值View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn = 55555;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1int MIN[maxn<<2];int MAX[maxn<<2];int min(int a,int Read More
posted @ 2012-01-02 13:47 Because Of You Views(519) Comments(0) Diggs(0) Edit