摘要: 思路:这题的原型题是比较经典的网络流。原型题模型就是把所有的障碍去掉。有障碍做法还是一样的,只用将每个列和行重新划分,求最大流就行了。#include #include #include #include #define Maxn 120010#define Maxm 210000#define LL int#define inf 100000000#define Abs(a) (a)>0?(a):(-a)using namespace std;struct Edge{ int from,to,next; LL val;}edge[Maxm];const double eps=1e... 阅读全文
posted @ 2013-10-04 15:57 fangguo 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 思路:这题的N有500,直接floyd肯定超时。我的做法是每次枚举一个点,求出包含这个点的最小环。对所有最小环取最小值。求包含某个点的最小环我用的是启发式搜索,先以该点求一次spfa,然后dfs解决问题。#include#include#include#include#define Maxn 600#define inf 1000000using namespace std;int head[Maxn],vi[Maxn],dis[Maxn],e,que[Maxn*100],ans,dist[Maxn];struct Edge{ int u,v,next;}edge[Maxn*100];v... 阅读全文
posted @ 2013-10-04 14:48 fangguo 阅读(273) 评论(0) 推荐(0) 编辑