摘要: DescriptionGiven a weighted directed graph, we define the shortest path as the path who has the smallest length among all the path connecting the source vertex to the target vertex. And if two path is said to be non-overlapping, it means that the two path has no common edge. So, given a weighted dir 阅读全文
posted @ 2013-08-03 22:13 Oyking 阅读(430) 评论(0) 推荐(0)
摘要: DescriptionFarmer John is constructing a new milking machine and wishes to keep it secret as long as possible. He has hidden in it deep within his farm and needs to be able to get to the machine without being detected. He must make a total of T (1 #include #include using namespace std;const int MAXN 阅读全文
posted @ 2013-08-03 17:54 Oyking 阅读(467) 评论(0) 推荐(0)
摘要: DescriptionGiven two strings, you have to tell the length of the Longest Common Substring of them.For example:str1 = bananastr2 = cianaicSo the Longes... 阅读全文
posted @ 2013-08-02 16:08 Oyking 阅读(1716) 评论(0) 推荐(0)
摘要: DescriptionYou are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to... 阅读全文
posted @ 2013-08-01 16:12 Oyking 阅读(9840) 评论(0) 推荐(4)
摘要: DescriptionYou are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quickly k-th order statistics in the array segment.That is, given an array a[1...n] of differ 阅读全文
posted @ 2013-07-31 17:45 Oyking 阅读(401) 评论(0) 推荐(0)
摘要: DescriptionThe Contortion Brothers are a famous set of circus clowns, known worldwide for their incredible ability to cram an unlimited number of them... 阅读全文
posted @ 2013-07-30 22:51 Oyking 阅读(358) 评论(0) 推荐(0)
摘要: DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, say T = (V', E'), with the following properties:1. V' = V.2. T is connected 阅读全文
posted @ 2013-07-30 16:57 Oyking 阅读(229) 评论(0) 推荐(0)
摘要: DescriptionOnce in a forest, there lived N aggressive monkeys. At the beginning, they each does things in its own way and none of them knows each othe... 阅读全文
posted @ 2013-07-30 16:06 Oyking 阅读(329) 评论(0) 推荐(0)
摘要: DescriptionWhen it comes to theMaya Civilization, we can quickly remind of a term called the end of the world. It's not difficult to understand why we choose to believe the prophecy (or we just assume it is true to entertain ourselves) if you know the other prophecies appeared in theMaya Calenda 阅读全文
posted @ 2013-07-30 11:33 Oyking 阅读(253) 评论(0) 推荐(0)
摘要: DescriptionGiven a rooted tree, each node has a boolean (0 or 1) labeled on it. Initially, all the labels are 0.We define this kind of operation: given a subtree, negate all its labels.And we want to query the numbers of 1's of a subtree.InputMultiple test cases.First line, two integerNandM, den 阅读全文
posted @ 2013-07-29 22:39 Oyking 阅读(326) 评论(0) 推荐(0)