题目大意:有n个点m条单向边,每条边有一个容量.现有x人要分批从1走到n,问每批最多能走多少人,分几批运完(或输出无法运完). 解题思路:一看就是网络流的题目.每批最多能走多少人,即最大流.分几批运完,除一下即可.当最大流为0时无法运完. 以下是Dinic算法的代码(为什么我那么喜欢用Dinic?因为我个人认为它好写!): C++ Code: #include<cstdio> #include<queue> #include<cstring> using namespa…
洛谷4951 地震 #include<iostream> #include<cstdio> #include<algorithm> #define go(i,a,b) for(register int i=a;i<=b;i++) #define ll long long #define db long double #define M 10001 #define N 401 #define inf 1e15 #define eps 1e-12 using name…
P1948 [USACO08JAN]电话线Telephone Lines 题目描述 Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he needs to pay for some of the cables required to connect his farm to the phone system. There a…