这道题比起DISQUERY来就是用线段树上加一个修改了,其他部分一样,注意边的序号跟踪#include<cstdio> #include<cstdlib> #include<cstring> #include<set> #include<algorithm> #include<map> #include<vector> #include<queue> #include<iostream> #include<string> #include<cmath> #define N 20010 #define lc(x) (x<<1) #define rc(x) ((x<<1)+1) #define FOR(i,a,b) for(i=(a);i<=(b);i++) #define ROF(i,a,b) for(i=(a);i>=(b);i--) typedef long long LL; using namespace std; struct node{int l,r,Max;}; int last[N],pre[N],e[N],W[N],idx[N]; int w[N],pos[N],siz[N],son[N],fa[N],dep[N],top[N],b[N]; int a[N];char OP[101]; int t1,t2,t3,n,q,len=0,size=0; void add(int x,int y,int z,int ID)
Views:
565
|
Added by:
dhy0077
|
Date:
11.21.2013
|
#include<cstdio> #include<cstdlib> #include<cstring> #include<set> #include<algorithm> #include<map> #include<vector> #include<queue> #include<iostream> #include<string> #include<cmath> #define N 200010 #define lc(x) (x<<1) #define rc(x) ((x<<1)+1) #define FOR(i,a,b) for(i=(a);i<=(b);i++) #define ROF(i,a,b) for(i=(a);i>=(b);i--) typedef long long LL; using namespace std; struct Info{int Max,Min;}; struct node{int l,r;Info info;}; int last[N],pre[N],e[N],W[N]; int w[N],pos[N],siz[N],son[N],fa[N],dep[N],top[N],b[N]; Info a[N]; int t1,t2,t3,n,q,len=0,idx=0; void add(int x,int y,int z) {pre[++len]=last[x];last[x]=len;e[len]=y;W[len]=z;}
Views:
414
|
Added by:
dhy0077
|
Date:
11.21.2013
| |