拓扑排序
哆啦AC梦
软件工程
展开
-
HDU 5438 Ponds
PondsProblem DescriptionBetty owns a lot of ponds, some of them are connected with other ponds by pipes, and there will not be more than one pipe between two ponds. Each pond has a valuev.No原创 2015-09-17 19:27:40 · 639 阅读 · 0 评论 -
POJ 2513 Colored Sticks
DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints原创 2015-08-17 14:54:38 · 619 阅读 · 0 评论 -
HDU 5813 Elegant Construction(构造)
题目链接:点击打开链接题目大意:给定n个点,和n个整数,n个整数代表标号为i的顶点要和其他第ni个点相连,输出一个合法地图。题目解析:将顶点按能到达的点数从小到大排序,排好序之后每个点只能往前面的点连边. 因而如果存在一个排在第i位的点,要求到达的点数大于i-1,则不可行;否则就可以按照上述方法构造出图. 复杂度O(N^2).#include #include #include原创 2016-08-10 08:34:16 · 469 阅读 · 0 评论