随笔分类 - 最短路径
摘要:/* O(V^3) 案例: 1 2 2 1 3 5 2 3 1 */ #include <cstdio>#include <iostream>using namespace std; const int MAX_V = 100;int d[MAX_V][MAX_V];//d[u][v] 表示边e=(
阅读全文
摘要:/* O(E*logV) */ #include"cstdio"#include"queue"#include"algorithm"#define INF 1<<28#define MAX 300using namespace std;int v,e,s;int graph[MAX][MAX];//
阅读全文
摘要:https://vjudge.net/problem/HDU-2680 思路:单边,将终点看做起点,反向建立图,否则超时 #include <cstdio>#include <cstring>#include <iostream>using namespace std; const int maxn
阅读全文
摘要:/* O(V^2) */ #include<cstdio>#include<iostream>#include<cstring>using namespace std; int v,e;//顶点数const int INF=1<<30;const int max_v=1e4+5;int d[max_
阅读全文
摘要:/*可解决图中存在环(负权值)问题,dijksta则不能 O(V*E) */ #include<iostream>#include<cstdio>#include<cstring>using namespace std;const int max_v=1170;const int max_e=217
阅读全文
浙公网安备 33010602011771号