题意 有$N$头牛,序号为1-N(来自不同牛场),他们要去序号为$X$x的地方参加派对, 问去+返的最少时间。(但是我有疑惑的是:题目的输出给的是“the maximum of time”???) 每组数据给出N、M、X,接下来M条边,是有向图。 思路 先用Dijkstra跑一遍最短路,接着讲该邻接 ...
分类:
其他好文 时间:
2020-07-26 15:01:15
阅读次数:
70
Silver Cow Party Description One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at ...
分类:
其他好文 时间:
2020-07-10 13:33:46
阅读次数:
81
#include<iostream> #include<queue> #include<cstring> using namespace std; const int N=200000+10,INF=0x3f3f3f3f; int h[N],e[N],ne[N],w[N],idx; int n,m, ...
分类:
其他好文 时间:
2020-01-29 12:10:32
阅读次数:
56
// 带飞网址 ???????? 专题四 最短路练习 √ POJ 2387 Til the Cows Come HomePOJ 2253 FroggerPOJ 1797 Heavy TransportationPOJ 3268 Silver Cow PartyPOJ 1860 Currency Ex ...
分类:
其他好文 时间:
2019-10-25 09:55:52
阅读次数:
91
题目链接: "POJ 3268" Description One cow from each of $N$ farms $(1 ≤ N ≤ 1000)$ conveniently numbered $1..N$ is going to attend the big cow party to be h ...
分类:
其他好文 时间:
2019-10-13 20:25:54
阅读次数:
90
"更好的阅读体验" Portal Portal1: "POJ" Portal2: "Luogu" Description One cow from each of N farms $(1 \le N \le 1000)$ conveniently numbered $1 \cdots N$ is g ...
分类:
其他好文 时间:
2019-09-26 21:26:00
阅读次数:
80
"更好的阅读体验" Portal Portal1: "Luogu" Portal2: "POJ" Description One cow from each of N farms $(1 \le N \le 1000)$ conveniently numbered $1 \cdots N$ is g ...
分类:
其他好文 时间:
2019-09-26 21:07:27
阅读次数:
82
One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total ...
分类:
其他好文 时间:
2019-09-06 20:07:15
阅读次数:
81
"Silver Cow Party" 给出一个n个点m条边的有向图,$w[i][j]$为i到j的边权,给出一个点X,询问从每个点出发到达X再回到起点的路径长度和最大值,$n\leq 1000,m\leq 100000$。 解 显然为单源最短路径的题目,考虑点为起点终点的取反,建反边,工具是bfs(边 ...
分类:
其他好文 时间:
2019-08-25 17:55:18
阅读次数:
79
思路:有向图。假设在X牧场参加party,从X回家的时候,以X为起点,使用一次Dijkstra算法即可。难点在于去X参加party的最短路如何求解。 这时候我们可以反向建图,即把原来有向图的方向全部反向,形成一幅新的有向图G',此时再对G'使用一次以X为起点的Dijkstra算法即 可求得原图G中其 ...
分类:
其他好文 时间:
2019-08-24 19:03:48
阅读次数:
105