- 博客(6)
- 收藏
- 关注
原创 POJ 1987 Distance Statistics 树上点分治
算是入门题了,详见《分治算法在树的路径问题中的应用》(by 漆子超)。#include #include #include #include #include #include #include #include #include #define LL long long#define INF 0x3f3f3f3f#define Mod 1000000007#def
2015-05-16 10:51:51 675
原创 树的重心
拿掉重心后,最大的联通分量的点的个数最少。using namespace std;const int MAXE = 80010;const int MAXP = 40010;struct EDGE{ int v,next;}edge[MAXE];int head[MAXP];int Top;void Link(int u,int v){ edge[Top
2015-05-16 08:53:23 706
原创 无向图求桥,允许重复边
#include #include #include #include #include #include #include #include #include #define LL long long#define INF 0x3f3f3f3f#define Mod 1000000007#define Seed1 31#define Seed2 37#define
2015-05-15 16:03:17 1457
原创 无向图求割点
using namespace std;const int MAXE = 300010;const int MAXP = 1010;struct N{ int v,next;}edge[MAXE*2];int head[MAXP];int Top;int high[MAXP];int low[MAXP];int subnet[MAXP];int dfsClock;
2015-05-15 15:04:13 1016
原创 有向图的强联通分量 tarjan
多与DAG上的DP之类的问题一起出现。using namespace std;const int MAXE = 300010;const int MAXP = 100010;struct N{ int v,next;}edge[MAXE];int head[MAXP];int Top;int ty[MAXP];int high[MAXP];int low
2015-05-15 10:38:45 993
原创 Codeforce 487B Strip 动归+二分+线段树
写完之后的第一感觉就是我又写麻烦了。。。写了两棵线段树维护信息。。。dp[i] 表示[1,i]这段前缀的最优解,若dp[i] = INF,表示无解。特殊的,dp[0] = 0。那么,有一个思路就是我们有一些长度为设dp[i]已知且dp[i] != INF,那么设我们知道一个位置R,满足[i+1,R]这一段区间可以划分到一段,i+1 = l。那么我们将dp[i+1],dp[i+2].
2015-05-04 17:44:32 1038
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人