网络流
Jerry_wang119
我是蒟蒻快来%我
展开
-
洛谷 4014 分配问题
最近刷水题,毫无含精量#include<bits/stdc++.h> const int N=100+10,M=100000+10; using namespace std; queue<int> q; int head[M],dis[M],flt[M],to[M],nxt[M],cn=1; int c[N],pree[N],pred[N],a[N][N]; int...原创 2018-03-08 10:44:15 · 368 阅读 · 0 评论 -
HDU 3549 float problem
网络流模板题,练着玩#include<bits/stdc++.h> const int N=15+5,M=1000+5; using namespace std; int head[M << 1],headnew[M << 1],nxt[M << 1],to[M << 1],flt[M << 1],cn=1; int d...原创 2018-02-22 14:27:03 · 192 阅读 · 0 评论 -
POJ 2135 Farm Tour
裸最小费用最大流问题#include<cstdio> #include<queue> #include<cstring> const int N=1000+10,M=10000+10; using namespace std; queue<int> q; int head[M << 2],nxt[M << 2],to[...原创 2018-02-22 15:49:48 · 114 阅读 · 0 评论 -
洛谷 2763 试题库问题
裸题,只要找准建边的方法就好了,跑一遍最大流,枚举从试题编号指向类型相连的单向边,如果其flow(flt[ ])的值为0,那么说明这道题就选了是不是;洛谷OJ是Special Judge,随便输出哪一个正确的就好了。#include<bits/stdc++.h>const int N=1000+4,M=1000000+10,K=30+5;using namespace std;queu...原创 2018-03-06 12:07:23 · 224 阅读 · 0 评论 -
洛谷 3254 圆桌问题
真的这题要用优化,register优化,当前弧优化,delta为真优化。#include<cstdio>#include<iostream>#include<cstring>#define RG registerusing namespace std;const int N = 6000001;const int M = 3000001;int s,t,tot ...原创 2018-03-06 12:16:36 · 194 阅读 · 0 评论 -
网络流24题 洛谷 4015 运输问题
#include <bits/stdc++.h> const int N = 500 + 5 ; std :: queue < int > q ; int head [ N << 8 ] , nxt [ N << 8 ] , flt [ N << 8 ] , dis [ N << 8 ] , to [ N <...原创 2018-05-06 14:05:45 · 167 阅读 · 0 评论 -
网络流24题 洛谷 4016 负载平衡问题
重在建图第一直觉是入门题目分纸牌,那道题是贪心的。但是网络流标签嘛就用网络流做了。建图:(流量,费用)1、超级源点 src + 超级汇点 sink2、对于仓库 i,拆成 Ai 和 Bi 两个点 2 . 1、从 Ai 向 Bi 建立 (inf,0) 2 . 2、从 Bi 向 Ai-1 和 Ai+1 建边 (inf,1)3、超级源点 和 Ai 建边 (库存,0)4、Bi 和 超级汇点 建边 (av...原创 2018-05-06 14:08:36 · 144 阅读 · 0 评论