摘要: 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 阅读(415) 评论(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 阅读(1639) 评论(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 阅读(9685) 评论(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 阅读(358) 评论(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 阅读(303) 评论(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 阅读(187) 评论(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 阅读(274) 评论(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 阅读(201) 评论(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 阅读(286) 评论(0) 推荐(0) 编辑
摘要: Description"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story."Prince Remmarguts lives in his kingdom UDF – United Delta of Freedom. One day their neighboring country sent them Pri 阅读全文
posted @ 2013-07-29 15:41 Oyking 阅读(249) 评论(0) 推荐(0) 编辑