2011年6月13日
摘要: LCA 资料: http://www.cnblogs.com/zgmf_x20a/archive/2008/10/15/1311313.html虽然网上这方面资料很多了, 不过自己练习后还是写下。。。POJ1330NearestCommonAncestors输入N-1条边,建一个树,然后是一个LCA查询,只有一次,朴素做比较快。树是唯一的。POJ1470ClosestCommonAncestors和上一题非常类似,不过点变少了,查询次数变多了,因为n<=900朴素就可以了。POJ1986DistanceQueries查询从u-v的距离。根据输入建一个树,以任意点位根都可以,距离是不变的。 阅读全文
posted @ 2011-06-13 16:46 cegr 阅读(1207) 评论(2) 推荐(2) 编辑
  2011年6月7日
摘要: The city of Thunder has many houses and they are powered by lightning. Two houses may be interconnected by a wire. The wires connect the houses such that there is exactly one path from one house to any other house in the city. Each house has a large battery that can store infinite electrical energy. 阅读全文
posted @ 2011-06-07 11:12 cegr 阅读(334) 评论(0) 推荐(0) 编辑
  2011年5月21日
摘要: 2010/5/21ZOJ 1889(理解大数取模) 1879(简单模拟) 1828(大数加法) 1858(unique) 1884(简单模拟) 1874(简单模拟) 1831(简单模拟,字符替换) 1871(数学) 1808(字符串匹配) 1814(简单模拟)2011-05-25 ZOJ 2202(DP) 2256(最小生成树) 2208(模拟) 2201(模拟)2011-05-27 ZOJ 1951(素数,模拟) 1915(模拟) 1883(DP) 2482(模拟) 2405(模拟) 2277(数学) 2104(排序扫描,或map) 2478(模拟) 3500(数学,积分) 3501(排序, 阅读全文
posted @ 2011-05-21 21:04 cegr 阅读(186) 评论(0) 推荐(0) 编辑