#include
#include
#define INFINITY 32768
#define VERTEX_MAX 50
using namespace std;
typedef char VertexType; //顶点类型
typedef int AdjType; //边的关系类型
typedef struct {
VertexType...
分类:
编程语言 时间:
2015-06-23 21:35:35
阅读次数:
120
题目链接:http://acm.swust.edu.cn/problem/767/Time limit(ms): 1000 Memory limit(kb): 65535Description在涪江河的两边共有n个城市,其中位于一边的城市属于1类城市,另外一边的属于2类城市,(特别的:...
分类:
编程语言 时间:
2015-06-22 16:17:37
阅读次数:
108
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int INF = INT_MAX;
//Edmond Karp.
bool EK_bfs(vector > &G, int src, int dest, vector &Pr...
分类:
编程语言 时间:
2015-06-20 10:35:21
阅读次数:
153
Til the Cows Come Home
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 33607
Accepted: 11383
Description
Bessie is out in the field and wants to get back t...
分类:
编程语言 时间:
2015-06-19 16:55:12
阅读次数:
132
#define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int INF = INT_MAX;
struct Node{
int pre;
int d...
分类:
编程语言 时间:
2015-06-17 21:51:01
阅读次数:
306
题目链接:http://acm.swust.edu.cn/problem/842/Time limit(ms): 1000 Memory limit(kb): 10000Description2012新的暑期集训开始了,一切都还相当不错,但是有一个问题成为了同学们的难题,那就是从实验室...
分类:
编程语言 时间:
2015-06-16 12:52:36
阅读次数:
155
转载链接:http://blog.csdn.net/niushuai666/article/details/6791765Dijkstra算法是处理单源最短路径的有效算法,但它局限于边的权值非负的情况,若图中出现权值为负的边,Dijkstra算法就会失效,求出的最短路径就可能是错的。这时候,就需要使...
分类:
其他好文 时间:
2015-06-16 12:44:48
阅读次数:
95
这道题一开始我用dfs写了一次 = = 结果时间超限对于这种最短路径的问题来讲,效率更高的肯定是Floyd算法和Dijkstra算法单源最短路径最好自然是用Dijkstra,不过Floyd写起来简单,我就这样写咯#include #define INF 99999using namespace st...
分类:
其他好文 时间:
2015-06-11 22:31:57
阅读次数:
119
Description:The best friends Mr. Li and Mr. Liu are touring in beautiful country M.M has n cities and m two-way roads in total. Each road connects two...
分类:
编程语言 时间:
2015-06-10 20:43:41
阅读次数:
185
一 最短路径最短路径分为单源最短路径和任意两点的最短路径,前者用Dijkstra算法,后者用floyed算法。Dijkstra算法是一种广度优先算法,以起始点层层往外扩展,直至到终点为止。其把顶点分为两个集合: 1. 已经求出最短路径的节点集合 S 2. 未确定最短路径的顶点集合U通过逐渐把U中.....
分类:
编程语言 时间:
2015-06-04 11:43:44
阅读次数:
163