Time Limit: 20 Sec  Memory Limit: 512 MB
Submit: 809  Solved: 417
[Submit][Status][Discuss]

Description

Input

Output

Sample Input

3 3
2 3 4
1 1 2 2
1 2 3 5
1 3 3 2

Sample Output

14

HINT

Source

这题是来搞笑的么??

除了多循环几次之外和原版有啥区别?qwq、

#include<cstdio>
#include<algorithm>
#include<cmath>
#define LL long long
using namespace std;
const int MAXN = , INF = 1e9 + ;
const double eps = 1e-;
inline int read() {
char c = getchar();int x = ,f = ;
while(c < '' || c > ''){if(c == '-')f = -;c = getchar();}
while(c >= '' && c <= ''){x = x * + c - '',c = getchar();}
return x * f;
}
int N, M;
LL a[][];
void Pivot(int l, int e) {
double t = a[l][e]; a[l][e] = ;
for(int i = ; i <= N; i++) a[l][i] /= t;
for(int i = ; i <= M; i++) {
if(i != l && abs(a[i][e]) > eps) {
t = a[i][e]; a[i][e] = ;
for(int j = ; j <= N; j++)
a[i][j] -= a[l][j] * t;
}
}
}
bool simplex() {
while() {
int l = , e = ; double mn = INF;
for(int i = ; i <= N; i++)
if(a[][i] > eps)
{e = i; break;}
if(!e) break;
for(int i = ; i <= M; i++)
if(a[i][e] > eps && a[i][] / a[i][e] < mn)
mn = a[i][] / a[i][e], l = i;
Pivot(l, e);
}
return ;
}
int main() {
// freopen("a.in", "r", stdin);
srand();
N = read(); M = read();
for(int i = ; i <= N; i++) a[][i] = read();
for(int i = ; i <= M; i++) {
int K = read();
while(K--) {
int S = read(), T = read();
for(int j = S; j <= T; j++)
a[i][j] = ;
}
int C = read();
a[i][] = C;
}
simplex();
printf("%lld", -a[][]);
return ;
}

BZOJ3265: 志愿者招募加强版(线性规划)的更多相关文章

  1. bzoj3265: 志愿者招募加强版(线性规划+单纯形法)

    传送门 鉴于志愿者招募那题我是用网络流写的所以这里还是写一下单纯形好了-- 就是要我们求这么个线性规划(\(d_{ij}\)表示第\(i\)种志愿者在第\(j\)天能不能服务,\(x_i\)表示第\( ...

  2. 突然想看单纯形 BZOJ3265 志愿者招募加强版

    本来的版本是可以差分之后建图利用网络流,这个题是板子题,就当存个板子,嘻嘻嘻 讲解可以到卿学姐的算法讲堂 https://www.bilibili.com/video/av7847726?from=s ...

  3. BZOJ 3265 志愿者招募加强版(单纯形)

    3265: 志愿者招募加强版 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 848  Solved: 436[Submit][Status][Disc ...

  4. 【BZOJ 1061】 1061: [Noi2008]志愿者招募 (线性规划与网络流)**

    1061: [Noi2008]志愿者招募 Description 申奥成功后,布布经过不懈努力,终于成为奥组委下属公司人力资源部门的主管.布布刚上任就遇到了一个难 题:为即将启动的奥运新项目招募一批短 ...

  5. 【BZOJ1061/3265】[Noi2008]志愿者招募/志愿者招募加强版 单纯形法

    [BZOJ1061][Noi2008]志愿者招募 Description 申奥成功后,布布经过不懈努力,终于成为奥组委下属公司人力资源部门的主管.布布刚上任就遇到了一个难题:为即将启动的奥运新项目招募 ...

  6. BZOJ.3265.志愿者招募加强版(费用流SPFA)

    题目链接 见上题. 每类志愿者可能是若干段,不满足那个...全幺模矩阵(全单位模矩阵)的条件,所以线性规划可能存在非整数解. 于是就可以用费用流水过去顺便拿个rank2 233. //20704kb ...

  7. BZOJ 1061 志愿者招募 最小费用流&&线性规划建模

    题目链接: https://www.lydsy.com/JudgeOnline/problem.php?id=1061 题目大意: 申奥成功后,布布经过不懈努力,终于成为奥组委下属公司人力资源部门的主 ...

  8. BZOJ 1061: [Noi2008]志愿者招募(线性规划与网络流)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1061 题意: 思路: 直接放上大神的建模过程!!!(https://www.byvoid.com/z ...

  9. BZOJ 3265: 志愿者招募加强版 [单纯形法]

    传送门 一个人多段区间,一样.... 不过国家队论文上说这道题好像不能保证整数解.... #include <iostream> #include <cstdio> #incl ...

随机推荐

  1. WAKE-WIN10-SOFT-软件-Matlab配置及工具箱

    1Matlab 1,1Matlab下载,安装,配置,,, 1,2 2工具箱 2,1LibSVM 必应:https://www.bing.com/search?q=libsvm&qs=n& ...

  2. python入门21 pip安装、更新、卸载第三方包,验证包是否安装成功;pip自身更新升级

    1 安装第三方包 python3自带安装工具pip,且在安装时勾选添加path也会将pip.exe所在目录加入到环境变量(python安装目录\Scripts). 因此安装第三方软件特别简单,打开命令 ...

  3. VMware,win7与linux centos6.4文件互传,linux下挂载windows共享文件夹,vmware tools安装方法

    本方法是以win7,VMware9.0.1 ,centos6.4为基础实验的. 对于linux的初级使用阶段,都会Windows中使用linux虚拟机VMWare或者其它的.在Windows与linu ...

  4. Educational Codeforces Round 10 D. Nested Segments 【树状数组区间更新 + 离散化 + stl】

    任意门:http://codeforces.com/contest/652/problem/D D. Nested Segments time limit per test 2 seconds mem ...

  5. public /protected/private的作用域

    作用域 当前类 同一package 子孙类 其他package public √ √ √ √ protected √ √ √ × friendly √ √ × × private √ × × ×

  6. sst上传和下载码云

    第一次 Team-----share---->Add----->commit-------remote----->pull 第二次 直接share开始.

  7. js通过codeURL画二维码

    一.函数封装 //生成微信二维码 function xyqrcode(options) { var settings = { dom:'', render: 'canvas', //生成二维码的格式还 ...

  8. 论文笔记:Progressive Differentiable Architecture Search:Bridging the Depth Gap between Search and Evaluation

    Progressive Differentiable Architecture Search:Bridging the Depth Gap between Search and Evaluation ...

  9. Android学习笔记_53_Android界面的基本属性

    很好很全面http://www.eoeandroid.com/forum.php?mod=viewthread&tid=46859 布局: 在 android 中我们常用的布局方式有这么几种: ...

  10. Failed to resolve: com.android.support:appcompat-v7:23.*

    打开 sdk manager ,安装 android support repository.