一道多次询问的最近公共祖先问题。
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 40000 + 10;
struct Edge{
int to,cost;
Edge(){};
Edge(int _to,int _cost)
...
分类:
其他好文 时间:
2014-10-13 22:33:37
阅读次数:
208
Android Weekly is afree newsletterthat helps youto stay cutting-edge with your Android Developmenthttp://androidweekly.net/
分类:
移动开发 时间:
2014-10-13 20:31:47
阅读次数:
151
一棵树 开始每个点的权值都为1
2种操作1.将第i个点的权值增加x 2.求u到v这条路上最大的权值
树链剖分基础题
#include
#include
#include
using namespace std;
const int maxn = 100010;
struct edge
{
int v, next;
}e[maxn*2];
int first[maxn], cnt;...
分类:
其他好文 时间:
2014-10-13 17:54:29
阅读次数:
232
之一就是第一章,这是第二章。在开始之前,要对第一章内容说说我理解到的:(1)时序分析是节点对节点的分析。(2)这个latch edge是锁存上一个lunch edge输出的(满足建立关系的)值。(3)建立关系和建立时间余量。(4)保持关系和保持时间余量。特别是使用屁股计数就是实际TQ的分析方法。Ti...
分类:
其他好文 时间:
2014-10-13 17:44:59
阅读次数:
169
题目链接
题意: 给出一张无向图,求割点的个数
思路:很裸的题目,直接套用模版即可。
代码:
#include
#include
#include
#include
using namespace std;
const int MAXN = 1005;
struct Edge{
int to, next;
bool cut;
}edge...
分类:
Web程序 时间:
2014-10-13 12:06:59
阅读次数:
236
题目链接
题意: 给出一个无向图,按顺序输出桥
思路:求出所有的桥,然后按顺序输出即可
代码:
#include
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 10005;
struct Edge{
int to, nex...
分类:
其他好文 时间:
2014-10-13 11:20:50
阅读次数:
155
Reactor Cooling
求解有上下界最大流问题。
1、流量平衡。
2、满足上下界
模板题。
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 200000 + 10;
const int INF = 1 << 30;
struct Edge{...
分类:
其他好文 时间:
2014-10-11 13:18:25
阅读次数:
174
思路: 贪心,
每次删除最上面的边。。
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int M = 200008;
deque q;
vector vi;
int first_edge[M],next_edge[M],to[M],ty[M],sum;...
分类:
其他好文 时间:
2014-10-11 10:31:35
阅读次数:
207
这题主要是计算连通子图的个数(c)和不连通子图的个数(dc)还有连通度为1的子图的个数(c1)和连通度为2以上的子图的个数(c2)之间的转化关系
主要思路大概如下:
用状态压缩的方法算出状态为x的子图的不连通子图个数dc[x],dc[x] = ∑ c[i]*(2^edge[x-i]),i为x的子集且i中有x的编号最小的元素,edge[x] 表示x集合内有几条边
连通子图个数c[x] = 2...
分类:
其他好文 时间:
2014-10-09 02:03:18
阅读次数:
228
树链剖分基础题
#include
#include
#include
using namespace std;
const int maxn = 10010;
struct edge
{
int v, next;
}e[maxn*2];
int first[maxn], cnt;
int top[maxn], dep[maxn], sz[maxn], f[maxn], son[maxn...
分类:
其他好文 时间:
2014-10-06 02:55:39
阅读次数:
179