题目传送门题意:判断是否为哈密顿图分析:首先一种情况是不合法的:也就是度数为1的点超过2个;合法的有:,那么从度数为1的点开始深搜,如果存在一种走法能够走完n个点那么存在哈密顿路收获:学习资料代码:/************************************************* ...
分类:
其他好文 时间:
2015-09-05 17:37:42
阅读次数:
155
和HDU 3488一样的,只不过要判断一下是否有解。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int maxn = 1000 + 10;...
分类:
其他好文 时间:
2015-09-05 11:00:00
阅读次数:
208
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ’s undirected graph serialization:
Nodes are labeled uniquely.We use # as a separator for each node, an...
分类:
其他好文 时间:
2015-09-03 16:42:54
阅读次数:
105
7.6 Given a two-dimensional graph with points on it, find a line which passes the most number of points.这道题给了我们许多点,让我们求经过最多点的一条直线。给之前那道7.5 A Line Cut ...
分类:
其他好文 时间:
2015-09-03 00:43:18
阅读次数:
215
Book DescriptionThis is the Rough Cut version of the printed book.Much of the technology embodied by Apple's Cocoa software development frameworks hav...
分类:
其他好文 时间:
2015-09-03 00:40:30
阅读次数:
167
Rikka with Graph IITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1051Accepted Submission(s): 266...
分类:
其他好文 时间:
2015-09-02 17:09:48
阅读次数:
161
SPOJ375 Query on a tree 树链剖分no tagsYou are given a tree (an acyclic undirected connected graph) withNnodes, and edges numbered 1, 2, 3...N-1.We will ....
分类:
其他好文 时间:
2015-09-02 00:30:17
阅读次数:
176
显然资源集合处就是树的重心,这题需要动态维护树的重心。每个连通块以重心为根,用link-cut tree维护每个点的子树大小以及子树内所有点到它的距离和。合并两个连通块时,考虑启发式合并,暴力往大的树中添加叶子。添加叶子时,需要将叶子到重心路径上所有点的子树大小+1,距离和则加上一个等差数列。并且新...
分类:
其他好文 时间:
2015-09-01 21:32:19
阅读次数:
288
Find the number Weak Connected Component in the directed graph. Each node in the graph contains a label and a list of its neighbors. (a connected set ...
分类:
其他好文 时间:
2015-09-01 21:12:12
阅读次数:
344
8-27Study1.学习命令总结:(word写的,格式可能上传时出了点问题)1.1cut:针对字符串切片操作sort:排序操作uniq:去重操作cut命令:格式:cutOPTION...[FILE]...-b:只查找位-c:只查找字节-d:设定间隔符-f:设定选择显示文件项单文件#;游离多文件#,#连续多文件#-#-n:不分割复..
分类:
系统相关 时间:
2015-09-01 17:05:48
阅读次数:
320