摘要:
For a connected undirected weighted graph G, MST (minimum spanning tree) is a subgraph of G that contains all of G's vertices, is a tree, and sum of i 阅读全文
摘要:
A point belongs to a triangle if it lies inside the triangle or on one of its sides. Two triangles are disjoint if there is no point on the plane that 阅读全文
摘要:
Dima the hamster enjoys nibbling different things: cages, sticks, bad problemsetters and even trees! Recently he found a binary search tree and instin 阅读全文
摘要:
One day Natalia was walking in the woods when she met a little mushroom gnome. The gnome told her the following story: Everybody knows that the mushro 阅读全文
摘要:
I guess there's not much point in reminding you that Nvodsk winters aren't exactly hot. That increased the popularity of the public transport dramatic 阅读全文
摘要:
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out t 阅读全文
摘要:
You have been offered a job in a company developing a large social network. Your first task is connected with searching profiles that most probably be 阅读全文
摘要:
题意:给定N点,M边,求添加最少的边使之变为连通图的方案数。 思路:注意题目给出的M边可能带环,即最后生成的不一定是一棵树。但是影响不大。根据矩阵树定理,我们知道生成树的数量=N^(N-2),即点数^(连通数-2)。 此题把已经连通的看成一个整体,就可以得到数量为N^(cnt-2),然后考虑连通块内 阅读全文
摘要:
Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different. In Ancient Berland arenas in circu 阅读全文
摘要:
De Prezer loves rectangles.He has a n × m rectangle which there is a number in each of its cells. We show the number in the j - th column of the i - t 阅读全文