###### BZOJ 1927: [费用流]

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define N 2010
using namespace std;

inline char get(void) {
static char buf[1000000], *p1 = buf, *p2 = buf;
if (p1 == p2) {
p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
if (p1 == p2) return EOF;
}
return *p1++;
}
inline void read(int &x) {
x = 0; char c = get(); int sign = 1;
for (; c < '0' || c > '9'; c = get()) if(c == '-') sign = 0;
for (; c >= '0' && c <= '9'; x = (x << 1) + (x << 3) + c - '0', c = get());
x = sign ? x : -x;
}

int x0, y0, ans = 0, X1, X2, Y, n, cnt, sum;
struct point {
int x, y, w;
point(int _x = 0, int _y = 0, int _w = 0) :x(_x), y(_y), w(_w) {}
};
point a[N << 1];

bool cmp(const point &a, const point &b) {
if (a.x == x0 && a.y == y0) return true;
if (b.x == x0 && b.y == y0) return false;
int adx = a.x - x0, bdx = b.x - x0, ady = a.y - y0, bdy = b.y - y0;
if (adx * bdx < 0) return adx > bdx;
return ((ady * 1.0) / adx) < ((bdy * 1.0) / bdx);
}

int main(void) {
freopen("1.in", "r", stdin);
read(n);
for (int i = 0; i < n; i++) {
read(X1); read(X2); read(Y);
if (X1 > X2) swap(X1, X2);
a[cnt++] = point(X1, Y, X2 - X1);
a[cnt++] = point(X2, Y, X1 - X2);
}
for (int i = 0; i < cnt; i++) {
x0 = a[i].x; y0 = a[i].y;
sort(a, a + cnt, cmp); sum = 0;
if (a[0].w > a[1].w) swap(a[0], a[1]);
for (int j = 1; j < cnt; j++) ans = max(ans, sum += a[j].w);
}
cout << ans << endl;
return 0;
}

#### [BZOJ1283]序列（费用流）

2017-01-30 21:41:30

#### bzoj4977 -- 线段树模拟费用流

2017-08-22 18:50:39

#### BZOJ3130 [Sdoi2013]费用流

2016-06-11 16:07:32

#### bzoj1061志愿者招募 费用流or单纯形

2016-02-20 10:42:02

#### bzoj 4842: [Neerc2016]Delight for a Cat （费用流）

2017-06-27 16:18:18

#### bzoj 1937: [Shoi2004]Mst 最小生成树 费用流

2016-04-12 11:22:33

#### BZOJ 1283: 序列 最大费用费用流

2017-04-20 20:57:40

#### [BZOJ1061][NOI2008]志愿者招募（费用流神题单纯形裸题）

2016-03-15 18:37:43

#### bzoj 1449 && bzoj 2597 - 一类凸费用网络流

2016-02-14 19:26:27

#### bzoj3130【SDOI2013】费用流

2016-04-13 22:56:33

BZOJ 1927: [费用流]