Paid Roads
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 5481
Accepted: 1947
Description
A network of m roads connects N cities (numbered from 1 to N). T...
分类:
其他好文 时间:
2014-10-26 14:25:28
阅读次数:
112
HDU 1815, POJ 2749 Building roads
题目链接HDU
题目链接POJ
题意:
有n个牛棚, 还有两个中转站S1和S2, S1和S2用一条路连接起来。 为了使得任意牛棚两个都可以有道路联通,现在要让每个牛棚都连接一条路到S1或者S2。
有a对牛棚互相有仇恨,所以不能让他们的路连接到同一个中转站。还有b对牛棚互相喜欢,所以他们的路必须连到同一个中专站。
...
分类:
其他好文 时间:
2014-10-26 11:46:02
阅读次数:
399
Building Roads
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 9360
Accepted: 2690
Description
Farmer John had just acquired several new farms! He wants to...
分类:
其他好文 时间:
2014-10-24 12:59:25
阅读次数:
224
题目链接:http://poj.org/problem?id=1251思路:使用最小生成树算法,可以求解。需要注意的树Kruskal算法中使用了并查集,对于并查集用法需要注意。代码:#include #include using namespace std;const int N = 30, M =...
分类:
其他好文 时间:
2014-10-23 20:32:48
阅读次数:
204
题意 在n个村庄之间修路使所有村庄连通 其中有些路已经修好了 求至少还需要修多长路
还是裸的最小生成树 修好的边权值为0就行咯
#include
#include
#include
#include
using namespace std;
const int N = 105, M = 10050;
int par[N], n, m, mat[N][N];
int ans;
struc...
分类:
其他好文 时间:
2014-10-23 12:29:17
阅读次数:
200
题意 有n个村子 输入n 然后n-1行先输入村子的序号和与该村子相连的村子数t 后面依次输入t组s和tt s为村子序号 tt为与当前村子的距离 求链接所有村子的最短路径
还是裸的最小生成树咯
#include
#include
#include
using namespace std;
const int N=30,M=1000;
int par[N],n,m,ans;
struct...
分类:
其他好文 时间:
2014-10-23 10:45:21
阅读次数:
174
题意:有n个瞭望塔构成一个凸n边形,敌人会炸毁一些瞭望台,剩下的瞭望台构成新的凸包。在凸多边形内部选择一个点作为总部,使得敌人需要炸毁的瞭望塔最多才能使总部暴露出来。输出敌人需要炸毁的数目。分析:在炸毁同样数量的瞭望塔时,如何爆破才能使暴露出的面积最大。那就是集中火力炸掉连续的几个瞭望塔。直觉上是这...
分类:
其他好文 时间:
2014-10-23 01:22:54
阅读次数:
350
Constructing Roads In JGShining's Kingdom
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16262 Accepted Submission(s): 4633
Problem...
分类:
其他好文 时间:
2014-10-21 17:40:09
阅读次数:
171
模板题,唯一问题是当长度为1是,road是单数,不然road是复数roads。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int maxn=1021000;
struct node
{
int r;
int b...
分类:
其他好文 时间:
2014-10-19 17:07:26
阅读次数:
206
Jungle Roads
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 19536
Accepted: 8970
Description
The Head Elder of the tropical island of Lagrishan has ...
分类:
其他好文 时间:
2014-10-18 12:42:48
阅读次数:
198