codeforces 567 E. President and Roads dijkstra + 求图的桥
摘要:题意: 给出一个图,n <= 10^5,给出起点s和终点t 有向边,每花费一个单位的钱可以选择一条边,把它的边权-1,但是边权必须>0, 比如边权为w,最多花费w-1,边权变为1,但是不能把边权变为0 现在要选择一条最短路从s到t 题目保证s到t至少有一条路 问这个图 1.哪些边是一定会经过的 2.
阅读全文
posted @
2017-08-31 02:05
_fukua
阅读(269)
推荐(0)
SPOJ Query on a tree 树链剖分 水题
摘要:You are given a tree (an acyclic undirected connected graph) withNnodes, and edges numbered 1, 2, 3...N-1.We will ask you to perfrom some instructions...
阅读全文
posted @
2015-10-15 18:47
_fukua
阅读(215)
推荐(0)
CF109 C. Lucky Tree 并查集
摘要:Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits4and7. ...
阅读全文
posted @
2015-10-14 17:58
_fukua
阅读(435)
推荐(0)
CF 191C Fools and Roads lca 或者 树链剖分
摘要:They say that Berland has exactly two problems, fools and roads. Besides, Berland hasncities, populated by the fools and connected by the roads. All B...
阅读全文
posted @
2015-10-13 13:18
_fukua
阅读(466)
推荐(0)
CF 486D vailid set 树形DP
摘要:As you know, an undirected connected graph withnnodes andn - 1edges is called atree. You are given an integerdand a tree consisting ofnnodes. Each nod...
阅读全文
posted @
2015-10-13 12:23
_fukua
阅读(311)
推荐(0)
hdu 5444 Elven Postman 二叉树
摘要:Time Limit: 1500/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Problem DescriptionElves are very peculiar creatures. As we all know,...
阅读全文
posted @
2015-09-14 17:03
_fukua
阅读(263)
推荐(0)
CF 337D Book of Evil 树形DP 好题
摘要:Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area containsnsettlements numbered from 1 ton. Moving through the sw...
阅读全文
posted @
2015-08-30 22:40
_fukua
阅读(257)
推荐(0)
CF 274B Zero Tree 树形DP
摘要:Atreeis a graph withnvertices and exactlyn - 1edges; this graph should meet the following condition: there exists exactly one shortest (by number of e...
阅读全文
posted @
2015-08-28 23:04
_fukua
阅读(375)
推荐(0)
CF 461B Appleman and Tree 树形DP
摘要:Appleman has a tree withnvertices. Some of the vertices (at least one) are colored black and other vertices are colored white.Consider a set consistin...
阅读全文
posted @
2015-08-28 17:46
_fukua
阅读(260)
推荐(0)
CF 500D New Year Santa Network tree 期望 好题
摘要:New Year is coming in Tree World! In this world, as the name implies, there arencities connected byn - 1roads, and for any two distinct cities there a...
阅读全文
posted @
2015-08-27 23:13
_fukua
阅读(373)
推荐(0)
CF 161D Distance in Tree 树形DP
摘要:一棵树,边长都是1,问这棵树有多少点对的距离刚好为k令tree(i)表示以i为根的子树dp[i][j][1]:在tree(i)中,经过节点i,长度为j,其中一个端点为i的路径的个数dp[i][j][0]:在tree(i)中,经过节点i,长度为j,端点不在i的路径的个数则目标:∑(dp[i][k][0...
阅读全文
posted @
2015-08-27 19:47
_fukua
阅读(314)
推荐(0)
CF 369C . Valera and Elections tree dfs 好题
摘要:C. Valera and ElectionsThe city Valera lives in is going to hold elections to the city Parliament.The city hasndistricts andn - 1bidirecti...
阅读全文
posted @
2015-08-24 23:35
_fukua
阅读(328)
推荐(0)
CF 501C Misha and Forest 好题
摘要:C. Misha and ForestLet's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played...
阅读全文
posted @
2015-08-24 15:56
_fukua
阅读(275)
推荐(0)