Code: #include<cstdio> #include<algorithm> #include<vector> #include<queue> #include<iostream> #include<cstring> using namespace std; typedef long long ll; const int maxn=2005; const int maxd=1000000+233; const int INF=…
/** zoj提交评判不了,所以不知道代码正不正确.思路是应该没问题的.如果有不对的地方,请多指教. 题目:Shoot the Bullet ZOJ - 3229 链接:https://vjudge.net/problem/20756 题意: 高富帅给m个女神拍照,拍照n天,第i天给ci个女神拍照,给出了具体ci个女神的编号,以及在第i天给ci个女神分别给出拍照数量限制[l,r]. 第i天最多拍照Di次.拍照n天后,第i个女神总共最少拍照Gi次.求高富帅最多拍照次数. 思路: 建立源点s,t.…
1: /** 2: ZOJ 3229 有上下界的最大流 3: 两次求最大流的过程,非二分 4: 有源汇上下界的最大流问题, 首先连接 sink -> src, [0,INF]. 5: 根据net的正负,来建立 Supersrc 与 supersink 之间的边,做一次 maxflow. 6: 若所有的Supersrc 与 Supersink满流,则说明存在可行流. 7: 然后删除 sink -> src之间的边.(cap 置零即可). 从src -> sink 做一次最大流. 8: 两次…
Shoot the Bullethttp://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3442 Time Limit: 2 Seconds      Memory Limit: 32768 KB      Special Judge Gensokyo is a world which exists quietly beside ours, separated by a mystical border. It is a utopia…
有源汇带上下界最大流 在原图基础上连一条汇点到源点流量为inf的边,将有源汇网络流转化为无源汇网络流用相同方法判断是否满流,如果满流再跑一边源点到汇点的最大流就是答案 例题:Shoot the Bullet 东方文花帖 题目传送门 #include <bits/stdc++.h> using namespace std; /* freopen("k.in", "r", stdin); freopen("k.out", "w&…
题意: 一个屌丝给m个女神拍照,计划拍照n天,每一天屌丝给给定的C个女神拍照,每天拍照数不能超过D张,而且给每个女神i拍照有数量限制[Li,Ri],对于每个女神n天的拍照总和不能少于Gi,如果有解求屌丝最多能拍多少张照,并求每天给对应女神拍多少张照:否则输出-1. 分析: 增设一源点st,汇点sd,st到第i天连一条上界为Di下界为0的边,每个女神到汇点连一条下界为Gi上界为oo的边,对于每一天,当天到第i个女孩连一条[Li,Ri]的边. 建图模型:源点s,终点d.超级源点ss,超级终点dd.首…
#pragma warning(disable:4996) #include <iostream> #include <cstring> #include <string> #include <vector> #include <cstdio> #include <algorithm> #include <cmath> #include <queue> #include <map> #include…
题目:problemId=3442" target="_blank">ZOJ Problem Set - 3229 Shoot the Bullet 分类:有源有汇有上下界网络流 题意:有 n 天和 m 个girls,然后每天给一部分girls拍照,每一个girls 有拍照的下限.即最少要拍这么多张.然后每天有k个女孩拍照,摄影师最多能够拍num张,然后 k 个女该每天拍照数量值有上下限,然后问你有没有满足这样条件的给女孩拍照的最慷慨案.然后依照输入输出每天给女孩拍照的…
[算法]有上下界网络流-无源汇(循环流) [题解]http://www.cnblogs.com/onioncyc/p/6496532.html //未提交 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; ,maxm=,inf=0x3f3f3f3f; struct edge{int from,v,flow;}e[maxm]; ,first[maxn],cur[maxn]…
题目: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3496 大概意思:给你一个网络,有源汇,在保证最大流的情况下求下面两个问题答案 1.所有边中流量最大的边流量最小 2.所有边中流量最小的边流量最大 题解: De了一下午啊啊,之前学的上下界网络流有问题! 对于问题一,我们二分最大流量,每次建图跑最大流,看是不是和之前一样即可 对于问题二,我们同样二分答案lim,这样每条边满足流量限制w[i]∈[lim,c[i]] 这…