题意 有 N 个牛栏,现在通过一条通道(s1,s2)要么连到s1,要么连到s2,把他们连起来,他们之间有一些约束关系,一些牛栏不能连在同一个点,一些牛栏必须连在同一个点,现在问有没有可能把他们都连好,而且满足所有的约束关系,如果可以,输出距离最大的两个牛栏之间距离最小值(两点距离是指哈密顿距离) S ...
分类:
其他好文 时间:
2018-02-23 20:39:12
阅读次数:
160
Description There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each oth ...
分类:
其他好文 时间:
2018-02-23 18:55:22
阅读次数:
251
A - Jungle Roads A - Jungle Roads A - Jungle Roads 思路:并查集的板子,重点是字符的转换,不能忘了加上1。 #include<cmath> #include<cstdio> #include<cstdlib> #include<cstring> #i ...
分类:
其他好文 时间:
2018-02-23 10:47:59
阅读次数:
154
Fools and Roads CodeForces - 191C 题意:给出一棵n个节点的树,还有树上的k条简单路径(用路径的两个端点u和v表示),求树上的各条边被这些简单路径经过的总次数。 方法: 一开始想了很久..想要在倍增求lca的同时统计边经过的次数..然而发现这样子可以统计,但是统计的值 ...
分类:
其他好文 时间:
2018-02-11 10:41:37
阅读次数:
139
light1002:传送门 【题目大意】 n个点m条边,给一个源点,找出源点到其他点的‘最短路’ 定义:找出每条通路中最大的cost,这些最大的cost中找出一个最小的即为‘最短路’,dijkstra变形。dis[i]为s->i的‘最短路’ ...
分类:
其他好文 时间:
2018-02-10 11:20:12
阅读次数:
142
裸的最小生成树 输入很蓝瘦 **并查集 找到x在并查集里的根结点,如果两个端点在同一个集合内,find之后两个值就相等了 每次找到权值最小的端点不在同一集合的边 把两个集合合并 ...
分类:
其他好文 时间:
2018-02-08 00:24:30
阅读次数:
131
Constructing Roads In JGShining's Kingdom Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 27358 A ...
分类:
其他好文 时间:
2018-02-06 23:10:59
阅读次数:
359
Description $Byteotia$ 城市有 $n$ 个 $towns$,$m$条双向 $roads$. 每条 $road$ 连接两个不同的 $towns$ ,没有重复的 $road$ . 你要把其中一些$road$ 变成单向边使得:每个 $town$ 都有且只有一个入度 Input 第一行 ...
分类:
其他好文 时间:
2018-02-05 10:44:00
阅读次数:
129
Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gainin ...
分类:
其他好文 时间:
2018-02-04 14:41:00
阅读次数:
150
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want ...
分类:
编程语言 时间:
2018-01-26 22:50:46
阅读次数:
228