摘要: Input: petri.in A Petri net is a computational model used to illustrate concurrent activity. Each Petri net contains some number of places (represente... 阅读全文
posted @ 2015-06-19 17:14 Say舞步 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 刚开始想用结论:若最终天平平衡,则在同一个深度的所有结点,无论它的祖先结点是什么,重量都应该相同。并且上一层的重量应该是下一层的2倍。证明其实是显然的。。之后只需要把所有的结点分块,然后取结点最多的块,其余的结点都要修改,就是答案。但是代码并不是很简洁,后来参考别人的做法,知道可以反过来想:要使得改... 阅读全文
posted @ 2015-06-19 15:43 Say舞步 阅读(230) 评论(0) 推荐(0) 编辑
摘要: dfs和bfs都能做,我用dfs遍历了,dfs应该要快,我AC了之后找了找网上bfs写的,时间是我的9倍以上,都比较慢,所以用dfs还是很不错的,注意递归的条件。AC代码:#include #include #include #include #include #include #include #... 阅读全文
posted @ 2015-06-19 13:54 Say舞步 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 、bfs求最短路,经典数据结构题目。AC代码:#include #include #include #include #include #include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2015-06-19 09:26 Say舞步 阅读(131) 评论(0) 推荐(0) 编辑