TSP是NP难,但是把问题简化,到最右点之前的巡游路线只能严格向右,到最右边的点以后,返回的时候严格向左,这个问题就可以在多项式时间内求出来了。写的记忆化,懒得想递推顺序。。。#includeusing namespace std;const int maxn = 1001;int x[maxn],...
分类:
其他好文 时间:
2015-08-12 21:23:27
阅读次数:
141
hdu 1198 的传送门Sample Input2 2
DK
HF
3 3
ADC
FJK
IHE-1 -1
Sample Output2
3
题目大意:有如上图11种土地块,块中的绿色线条为土地块中修好的水渠,现在一片土地由上述的各种土地块组成,需要浇水,问需要打多少口井。
解题思路:用并查集,注意要初始化就好了#include
#include
#...
分类:
其他好文 时间:
2015-08-09 22:32:16
阅读次数:
142
Avoid The Lakes
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 7034
Accepted: 3740
点击打开链接
Description
Farmer John's farm was flooded in the most recent...
分类:
其他好文 时间:
2015-08-08 09:13:04
阅读次数:
162
DescriptionBeing the only living descendant of his grandfather, Kamran the Believer inherited all of the grandpa’s belongings. The most valuable one was a piece of convex polygon shaped farm in the gra...
分类:
其他好文 时间:
2015-08-07 22:27:41
阅读次数:
103
题意:一个王国有N个城市,M条路,都是有向的,现在可以去旅游,不过走的路只能是环(至少也需要有两个城市),他们保证这些城市之间的路径都是有环构成的,现在至少需要走多少路。分析:因为是有向图所以,而且走的是环所以每个城市都会进入一次并且出去一次,构成二分图,并且是完备匹配(完备匹配后肯定都是环了),现...
分类:
其他好文 时间:
2015-08-06 09:24:53
阅读次数:
111
Avoid The LakesTime Limit:1000MSMemory Limit:65536KTotal Submissions:7023Accepted:3735DescriptionFarmer John's farm was flooded in the most recent sto...
分类:
其他好文 时间:
2015-08-05 20:10:36
阅读次数:
134
PIGS
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 18123
Accepted: 8246
Description
Mirko works on a pig farm that consists of M locked pig-houses and...
分类:
其他好文 时间:
2015-08-05 16:26:59
阅读次数:
107
Avoid The LakesDescriptionFarmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly...
分类:
其他好文 时间:
2015-08-05 00:58:42
阅读次数:
113
Avoid The LakesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6908Accepted: 3680DescriptionFarmer John's farm was flooded in the most recent...
分类:
其他好文 时间:
2015-08-04 20:48:35
阅读次数:
126