I have revised the solution.
所在版块:求学狮城 发贴时间:2007-10-16 01:15

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
for each node, store a number which is initialized to be the number of edges incident on that node. For node 0 (which represents outside), the number is infinity. we denote the number as node.mc.


changed = true;
while(changed)
{
changed = false;
for_each(node n in the graph except node 0)
{
sort n's adjacent nodes based on mc (from large to small).
k = 0; k1 = 0; prev_node = null;
for_each(node adj_n in the sorted adjacent nodes n)
{
if(adj_n.mc + k < n.mc)
{
n.mc = k + adj_n.mc;
changed = true;
}
k1 += number of edges between adj_n and n;
if(prev_node.mc > adj_n.mc)
{
k = k1;
}
prev_node = adj_n;
}
}
}

return node1.mc;
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

 相关帖子 我要回复↙ ↗回到正文
anyone interested to discuss about the last question in ACM this year? <Tunnels chancing   (75 bytes , 1139reads )
这样可以么? 房间   (343 bytes , 430reads )
I have revised the solution. 房间   (737 bytes , 369reads )
似乎还是不行 bugzzj   (221 bytes , 390reads )
是可以的 房间   (1023 bytes , 330reads )
看错了 房间   (154 bytes , 338reads )
And 房间   (88 bytes , 308reads )
顺带询问一个问题 房间   (267 bytes , 498reads )
如果child有到parent的ref的话。 bugzzj   (524 bytes , 451reads )
gr8. 房间   (142 bytes , 332reads )
construct a graph as follows icky   (178 bytes , 368reads )
disagree bugzzj   (149 bytes , 377reads )
so assume the spy enters 2 icky   (91 bytes , 345reads )
i think we can destroy the tunnels 2 0 and 2 1 simultaneously. bugzzj   (0 bytes , 346reads )
ok, i misunderstood the problem icky   (0 bytes , 322reads )
choose one of 3 or 4 icky   (0 bytes , 309reads )
opps! you are right. 吴永铮   (76 bytes , 311reads )
agree 吴永铮   (0 bytes , 272reads )
maxflow from vertex 0 to vertex 1 icky   (0 bytes , 317reads )
min-cut problem? icky   (54 bytes , 388reads )