摘要: #include#include#include#include#include#includeusing namespace std;#define inf 0x3fffffff#define maxn 40000int e[maxn],v[maxn],ne[maxn],u[maxn];int nn=-1;void add(int x,int y,int z){ ne[++nn]=e[x],e[x]=nn,v[nn]=y,u[nn]=z;}int s,t;int ch[maxn];bool tell(){ memset(ch,-1,sizeof(ch)); queue jj; jj.... 阅读全文
posted @ 2014-03-19 19:37 wangyucheng 阅读(283) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;#define M 1000010#define ll long longint e[M],ne[M],been[M],v[M],t[M],nn,qu[M],bo,he;ll w[M],dp[M],ans,tot,d[M*2];int n;int inc[M],a1[M*2],an;void add(int x,int y){ ne[++nn]=e[x],v[nn]=y,e[x]=nn;}void solv(int x){ int i; qu[he=bo=1]=x;while(he>= 阅读全文
posted @ 2014-03-17 20:50 wangyucheng 阅读(166) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;#define maxn 22000int nn,n;int e[maxn],ne[maxn],v[maxn],fa[maxn],w[maxn];void add(int x,int y,int z){ ne[++nn]=e[x],e[x]=nn,v[nn]=y,w[nn]=z; }struct node{ int ch[2],s,val,pre,siz,rt; }t[maxn];#define c(x,y) t[x].ch[y]void up(int x){ t[x].siz=t... 阅读全文
posted @ 2014-03-16 22:48 wangyucheng 阅读(119) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;#define maxn 200000struct node{ int l,r,val,dis,f;}t[maxn];int merge(int a,int b){ if(!a)return b; if(!b)return a; if(t[a].val>=1; t[y].val>>=1; i1=merge(x,i1); i2=merge(y,i2); printf("%d\... 阅读全文
posted @ 2014-03-13 20:39 wangyucheng 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 很神奇的线段树#include#include#include#include#include#includeusing namespace std;#define maxn 400000int n;struct P{ int l,r,v,num; }a[maxn];struct NODE{ int l,r,maxx,e,ma;}tree[maxn*2];int xx[maxn];void down(int x){ int y=xtree[z].maxx)tree[x].maxx=tree[y].maxx,tree[x].ma=tree[y].ma; else tree[x].max... 阅读全文
posted @ 2014-03-12 20:33 wangyucheng 阅读(208) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;#define maxn 50000#define inf 0x3fffffffint wa[maxn],wb[maxn],ss[maxn],sa[maxn],wv[maxn];int cmp(int *r,int a,int b,int c){ return r[a]==r[b]&&r[a+c]==r[b+c];}int n,a[maxn];void da(int *r,int m){ int i,j,p,*x=wa,*y=wb; for(i=0;i=0;i--)sa[-- 阅读全文
posted @ 2014-03-11 22:26 wangyucheng 阅读(116) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#includeusing namespace std;#define maxn 21000int nn,n;int e[maxn],v[maxn],ne[maxn],w[maxn],fa[maxn];void add(int x,int y,int z){ ne[++nn]=e[x],e[x]=nn,v[nn]=y,w[nn]=z;}struct node{ node *ch[2],*pre; int maxx,val,rt;}tree[maxn];node *null;void init(){ memset(e,0,si... 阅读全文
posted @ 2014-03-10 21:54 wangyucheng 阅读(134) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#includeusing namespace std;#define maxn 120#define maxm 22000#define eps 1e-7int nn;int e[maxn],ne[maxm],v[maxm],w[maxm];void add(int x,int y,int z){ nn++; ne[nn]=e[x]; e[x]=nn; v[nn]=y; w[nn]=z;}double f[maxn][maxn];int n,m;int d[maxn];double a[maxn];void ... 阅读全文
posted @ 2014-03-05 23:01 wangyucheng 阅读(208) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;#define maxn 3000000#define maxm 200001struct node{int l,r,s,a,b;}a[maxn];struct P{int x,y;bool operator>1;a[k].l=build(l,mid);a[k].r=build(mid+1,r);return k;}int change(int p,int x,int w){int k=++tot;a[k].a=a[p].a,a[k].b=a[p].b,a[k].l=a[p].l,a[ 阅读全文
posted @ 2014-02-24 19:26 wangyucheng 阅读(108) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#includeusing namespace std;#define maxn 12000int e[maxn],v[maxn*2],ne[maxn*2],w[maxn*2];bool vis[maxn];int n;int nn;void add(int x,int y,int z){nn++;ne[nn]=e[x];e[x]=nn;v[nn]=y;w[nn]=z;}void clear(){nn=0;memset(vis,0,sizeof(vis));memset(e,0,sizeof(e));}int tot,a[maxn 阅读全文
posted @ 2014-02-20 17:07 wangyucheng 阅读(131) 评论(0) 推荐(0) 编辑