06 2015 档案

摘要:原来听到树状数组这名字感觉很难,很高大上。学了一下发现不难。而且很好。 普通的数组修改某个值耗费为O(1),输出和为O(n);而树状数组为O(logn);lowbit(x){ return x&(-x);}返回的是x二进制最后一位1的位置; 有公式:cn=a(n-a^k+1)+.........+a 阅读全文
posted @ 2015-06-07 18:58 sweat123 阅读(255) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 using namespace std; 4 struct node 5 { 6 int id; 7 int val; 8 friend bool operatorb.id;15 }16 }17 };1... 阅读全文
posted @ 2015-06-07 16:36 sweat123 阅读(203) 评论(0) 推荐(0)
摘要:1 #include<stdio.h> 2 #include<queue> 3 using namespace std; 4 5 6 struct node 7 { 8 friend bool operator< (node x,node y) 9 { 10 return x.pre>y.pre;/ 阅读全文
posted @ 2015-06-07 14:04 sweat123 阅读(203) 评论(0) 推荐(0)
摘要://点双连通分量的求解//就是通过tarjan算法求出关节点时,与关节点的子树就是一个连通分量,可以通过画图得到//所以可以将与顶点u有关的边放到栈中,然后一但满足low[v]>=dfn[u](表面点u是割点)(注释:由于dfs,已经建好了u//的子树,所以栈中有顶点u的子树),就可以进行退栈,直到... 阅读全文
posted @ 2015-06-04 14:02 sweat123 阅读(507) 评论(0) 推荐(0)