EricYang

Tech Spot of Eric

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2011年4月22日

摘要: POJ 并查集 题目汇总:http://hi.baidu.com/czyuan_acm/blog/item/531c07afdc7d6fc57cd92ab1.html继续数据结构的复习,本次的专题是:并查集。 并查集,顾名思义,干的就是“并”和“查”两件事。很多与集合相关的操作都可以用并查集高效的解决。 两个操作代码: int Find(int x) { if (tree[x].parent != x) { tree[x].parent = Find(tree[x].parent); } return tree[x].parent; } void Merge(int a, int b, int 阅读全文
posted @ 2011-04-22 21:01 Eric-Yang 阅读(177) 评论(0) 推荐(0) 编辑

摘要: Fence RepairTime Limit:2000MSMemory Limit:65536KTotal Submissions:10913Accepted:3459DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needsN(1 ≤N≤ 20,000) planks of wood, each having some integer lengthLi(1 ≤Li≤ 50,000) uni 阅读全文
posted @ 2011-04-22 20:04 Eric-Yang 阅读(201) 评论(0) 推荐(0) 编辑

摘要: BabelfishTime Limit:3000MSMemory Limit:65536KTotal Submissions:18425Accepted:7950DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of 阅读全文
posted @ 2011-04-22 18:01 Eric-Yang 阅读(194) 评论(0) 推荐(0) 编辑