codeforces(Union-Find Set)
csdn_PatrickStar
这个作者很懒,什么都没留下…
展开
-
Misha Changing Handles
Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle t...原创 2019-02-22 15:47:41 · 133 阅读 · 0 评论 -
Knight Tournament
Hooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event. As f...原创 2019-02-22 15:53:10 · 149 阅读 · 0 评论 -
Cthulhu
…Once upon a time a man came to the sea. The sea was stormy and dark. The man started to call for the little mermaid to appear but alas, he only woke up Cthulhu… Whereas on the other end of the world ...原创 2019-02-22 15:52:33 · 473 阅读 · 0 评论 -
Destroying Array
You are given an array consisting of n non-negative integers a1, a2, …, an. You are going to destroy integers in the array one by one. Thus, you are given the permutation of integers from 1 to n defin...原创 2019-02-22 15:52:00 · 149 阅读 · 0 评论 -
Love Rescue
Valya and Tolya are an ideal pair, but they quarrel sometimes. Recently, Valya took offense at her boyfriend because he came to her in t-shirt with lettering that differs from lettering on her pullove...原创 2019-02-22 15:51:22 · 147 阅读 · 0 评论 -
Learning Languages
The “BerCorp” company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee ...原创 2019-02-22 15:50:42 · 249 阅读 · 0 评论 -
Ice Skating
Bajtek is learning to skate on ice. He’s a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow dr...原创 2019-02-22 15:49:58 · 436 阅读 · 0 评论 -
PolandBall and Forest
PolandBall lives in a forest with his family. There are some trees in the forest. Trees are undirected acyclic graphs with k vertices and k - 1 edges, where k is some integer. Note that one vertex is ...原创 2019-02-22 15:49:19 · 131 阅读 · 0 评论 -
Mahmoud and Ehab and the message
Mahmoud wants to send a message to his friend Ehab. Their language consists of n words numbered from 1 to n. Some words have the same meaning so there are k groups of words such that all the words in ...原创 2019-02-22 15:48:36 · 127 阅读 · 0 评论 -
Swaps in Permutation
You are given a permutation of the numbers 1, 2, …, n and m pairs of positions (aj, bj). At each step you can choose a pair from the given positions and swap the numbers in that positions. What is the...原创 2019-02-22 15:53:50 · 140 阅读 · 0 评论