摘要: 思路:这里必须要选择的点是2*k个,首先就是求一边斯坦纳树,然后做一次动态规划出每个状态下的最小值。#include#include#include#include#include#include#include#include#include#include#include#define Maxn 210#define Maxm 100010#define LL __int64#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (x>=1) res+=(s&1)*(i=inf) printf("No solution\n 阅读全文
posted @ 2013-08-28 17:18 fangguo 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 思路:虚拟一个0号节点,将每个点建一条到0号节点的边,权值为挖井需要的价值。并要保证0号节点同另外n个寺庙一样被选择即可。然后就是求斯坦纳树了。#include#include#include#include#include#include#include#include#include#include#include#define Maxn 1310#define Maxm 100010#define LL __int64#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (x q; dis[i][i]=0; q.push... 阅读全文
posted @ 2013-08-28 15:32 fangguo 阅读(301) 评论(0) 推荐(0) 编辑