2016年1月27日

[2016-01-27][树的直径]

摘要: [2016-01-27][树的直径]随机取一个顶点,跑一次dfs ,得到当前点能走到的最远的顶点 ,k再从k 跑一遍dfs ,得到的最远的顶点qk和q之间的距离,就是树的直径12345678910111213141516171819202122232425void dfs(int cur, int ct){ int k = 0; int size = v[cur].size(); ... 阅读全文

posted @ 2016-01-27 23:35 红洋 阅读(111) 评论(0) 推荐(0)

[2016-01-27][HDU][4607][Park Visit]

摘要: [2016-01-27][HDU][4607][Park Visit]E - Park VisitTime Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 4607DescriptionClaire and her little friend, ykw... 阅读全文

posted @ 2016-01-27 23:34 红洋 阅读(148) 评论(0) 推荐(0)

[2016-01-27][UVA][1395][D - Slim Span]

摘要: [2016-01-27][UVA][1395][D - Slim Span]时间:2016-01-21 11:06:30 星期四题目编号:UVA 1395题目大意:求所有生成树 最大边和最小边之差的最小值分析:想法是枚举所有边,但是分析之后发现可以不用枚举所有的树已知krukal得到的最小生成树得到的最小生成树,最大边最小也就是说,这个最大边,就是使得 最大边和最小边 差值最大的边那么,只需要... 阅读全文

posted @ 2016-01-27 23:22 红洋 阅读(165) 评论(0) 推荐(0)

[2016-01-27][POJ][1679][The Unique MST]

摘要: [2016-01-27][POJ][1679][The Unique MST]C - The Unique MSTTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 1679DescriptionGiven a connected undirec... 阅读全文

posted @ 2016-01-27 22:53 红洋 阅读(170) 评论(0) 推荐(0)

[2016-01-27][POJ][1751][B - Highways]

摘要: [2016-01-27][POJ][1751][B - Highways]B - HighwaysTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 1751DescriptionThe island nation of Flatopia is ... 阅读全文

posted @ 2016-01-27 22:47 红洋 阅读(236) 评论(0) 推荐(0)

[2016-01-27][HDU][1233][Constructing Roads]

摘要: [2016-01-27][HDU][1233][Constructing Roads]A - Constructing RoadsTime Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 1233Description某省调查乡村交通状况,得到的统计表... 阅读全文

posted @ 2016-01-27 22:25 红洋 阅读(148) 评论(0) 推荐(0)

[2016-01-27][kruskal]

摘要: [2016-01-27][kruskal]最小生成树 能保证最大边最小,最小边最小 1234567891011121314151617181920212223242526272829303132333435363738int n;const int maxn = 110;struct Edge{ int u,v; long long c; bool operator < (co... 阅读全文

posted @ 2016-01-27 22:24 红洋 阅读(138) 评论(0) 推荐(0)

[2016-01-27][ACM][邻接表数组实现]

摘要: [2016-01-27][ACM][邻接表数组实现]邻接表123456789101112const int maxn = 10000 + 100;const int maxedge = (50000 + 100)*2;int head[maxn];//head[i]表示第i个顶点,第一个链节的编号int next[maxedge];//表示 第 q 号链节,下一个链节的编号int end[maxe... 阅读全文

posted @ 2016-01-27 22:08 红洋 阅读(154) 评论(0) 推荐(0)

[2016-01-27][POJ][2230][Watchcow]

摘要: [2016-01-27][POJ][2230][Watchcow]H - 欧拉图 中级者向Time Limit:3000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 2230DescriptionBessie's been appointed the new watch... 阅读全文

posted @ 2016-01-27 22:08 红洋 阅读(181) 评论(0) 推荐(0)

导航