Topic: Same as 1061 but the range of work for each type of volunteer is multi-segment
Is this a card network stream? Unknown
Anyway, to change the 1061 slightly to be able to go through--
#include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include < algorithm> #define INF 1e10#define EPS 1e-7using namespace Std;int m,n;namespace linear_programming{double A[10100][ 1010],b[10100],c[1010],v;void Pivot (int l,int e) {int i,j;b[l]/=a[l][e];for (i=1;i<=n;i++) if (i!=e) a[l][i]/=a[l][e ]; A[l][e]=1/a[l][e];for (i=1;i<=m;i++) if (I!=l&&fabs (A[i][e]) >eps) {b[i]-=a[i][e]*b[l];for (j=1;j<= n;j++) if (j!=e) a[i][j]-=a[i][e]*a[l][j]; A[i][e]=-a[i][e]*a[l][e];} V+=c[e]*b[l];for (i=1;i<=n;i++) if (i!=e) c[i]-=c[e]*a[l][i];c[e]=-c[e]*a[l][e];} Double Simplex () {int I,l,e;while (1) {for (i=1;i<=n;i++) if (c[i]>eps) break;if ((e=i) ==n+1) return v;double temp= Inf;for (i=1;i<=m;i++) if (a[i][e]>eps && b[i]/a[i][e]<temp) temp=b[i]/a[i][e],l=i;if (Temp==INF) return INF; Pivot (l,e);}}} int main () {using namespace Linear_programming;int i,j,k,x,y;cin>>n>>m;for (i=1;i<=n;i++) scanf ("%lf", &c[i]); for (i=1;i<=m;i++) {scanf ("%d", &k); for (j=1;j<=k;j++) {scanf ("%d%d ", &x,&y); for (; x<=y;x++) a[i][x]+=1.0;} scanf ("%lf", &b[i]);} Double Ans=simplex ();p rintf ("%d\n", int (ans+0.5)); return 0;}
Bzoj 3265 Volunteers recruit Enhanced simplex