如果单单只安排过程1的时间最短,很容易算出来。用优先队列取最小,加上增量后再放回就行。对过程2也进行这样的操作。将过程1第一个完成的在过程2最后一个完成。以样例来说,过程1:1,1,2,2,3,过程2:1,2,3,3,4。那么小的和大的组合用时最少。

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <stack>
#include <bitset>
#define mkp make_pair
using namespace std;
const double EPS=1e-;
typedef long long lon;
const lon SZ=,INF=0x7FFFFFFF,mod=;
int inc[SZ]; struct nd{
int val,id;
nd(int a,int b):val(a),id(b){}
bool operator<(const nd &rbs)const
{
return val>rbs.val;
}
};
struct nnd{
int val,id;
nnd(int a,int b):val(a),id(b){}
bool operator<(const nnd &rbs)const
{
return val>rbs.val;
}
}; int main()
{
std::ios::sync_with_stdio();
//freopen("d:\\1.txt","r",stdin);
lon casenum;
//cin>>casenum;
//for(lon time=1;time<=casenum;++time)
{
int n,num1,num2;
cin>>n>>num1>>num2;
priority_queue<nd> pq1;
priority_queue<nnd> pq2;
for(int i=;i<=num1+num2;++i)
{
cin>>inc[i];
if(i<=num1)
{
pq1.push(nd(inc[i],i));
}
else pq2.push(nnd(inc[i],i));
}
vector<int> res1,res2;
for(int i=;i<n;++i)
{
nd tmp=pq1.top();
res1.push_back(tmp.val);
pq1.pop();
tmp.val+=inc[tmp.id];
pq1.push(tmp);
}
for(int i=;i<n;++i)
{
nnd tmp=pq2.top();
res2.push_back(tmp.val);
pq2.pop();
tmp.val+=inc[tmp.id];
pq2.push(tmp);
}
sort(res1.begin(),res1.end());
sort(res2.begin(),res2.end());
cout<<res1[res1.size()-]<<" ";
int maxv=;
for(int i=;i<res1.size();++i)
{
maxv=max(maxv,res1[i]+res2[res1.size()-i-]);
}
cout<<maxv<<endl;
}
return ;
}

p2751 Job Processing的更多相关文章

  1. 洛谷P2751 [USACO4.2]工序安排Job Processing

    P2751 [USACO4.2]工序安排Job Processing 18通过 78提交 题目提供者该用户不存在 标签 难度普及+/提高 提交  讨论  题解 最新讨论 暂时没有讨论 题目描述 一家工 ...

  2. 洛谷 P2751 [USACO4.2]工序安排Job Processing 解题报告

    P2751 [USACO4.2]工序安排Job Processing 题目描述 一家工厂的流水线正在生产一种产品,这需要两种操作:操作A和操作B.每个操作只有一些机器能够完成. 上图显示了按照下述方式 ...

  3. 洛谷P2751 工序安排Job Processing

    题目 任务调度贪心. 需要明确一点,任务调度贪心题,并不是简单地应用排序的贪心,而是动态的运用堆,使每次选择是都能保持局部最优,并更新状态使得下次更新答案可以取到正确的最小值. 这是A过程的解. 然后 ...

  4. OLTP(on-line transaction processing)与OLAP(On-Line Analytical Processing)

    OLTP与OLAP的介绍 数据处理大致可以分成两大类:联机事务处理OLTP(on-line transaction processing).联机分析处理OLAP(On-Line Analytical ...

  5. 新书到手 TRANSACTION PROCESSING:CONCEPTS AND TECHNIQUES

    新书到手 TRANSACTION PROCESSING:CONCEPTS AND TECHNIQUES Jim Gray大神的著作 本文版权归作者所有,未经作者同意不得转载.

  6. Report processing of Microsoft Dynamic AX

    Report processing of Microsoft Dynamic AX 版权声明:本文为博主原创文章,未经博主允许不得转载. The implementation of a general ...

  7. ANNOTATION PROCESSING 101 by Hannes Dorfmann — 10 Jan 2015

    原文地址:http://hannesdorfmann.com/annotation-processing/annotationprocessing101 In this blog entry I wo ...

  8. ORA-01078: failure in processing system parameters & LRM-00109: could not open parameter file

    安装了Oracle 12C后,启动数据库的过程中出现如下错误 SQL> startup ORA-01078: failure in processing system parameters LR ...

  9. Processing基础之绘画

    图形 //在(x, y)绘制点 point(x, y); //(x1, y1)到(x2, y2)的一条线 line(x1, y1, x2, y2); rect(x, y, weight, height ...

随机推荐

  1. topcoder srm 305 div1

    problem1 link 直接按照题意模拟即可. import java.util.*; import java.math.*; import static java.lang.Math.*; pu ...

  2. MongoDB的常用操作总结

    简介 MongoDB是一款强大.灵活.且易于扩展的通用型数据库 MongoDB 是由C++语言编写的,是一个基于分布式文件存储的开源数据库系统. 在高负载的情况下,添加更多的节点,可以保证服务器性能. ...

  3. Python hasattr() 函数 // python中hasattr()、getattr()、setattr()函数的使用

    http://www.runoob.com/python/python-func-hasattr.html https://www.cnblogs.com/zanjiahaoge666/p/74752 ...

  4. 关于 Image Caption 中测试时用到的 beam search算法

    关于beam search 之前组会中没讲清楚的 beam search,这里给一个案例来说明这种搜索算法. 在 Image Caption的测试阶段,为了得到输出的语句,一般会选用两种搜索方式,一种 ...

  5. WEB安全学习二、注入工具 sqlmap的使用

    使用的是Kali Linux 系统,系统中默认的sqlmap 是安装好了的,电脑上没有安装sqlmap,自己百度  ,需要python的环境 使用 命令   sqlmap -h 可以查看   sqlm ...

  6. Keepalived笔记

    Keepalived高可用服务对之间的故障切换转移,是通过 VRRP (Virtual Router Redundancy Protocol ,虚拟路由器冗余协议)来实现的. VRRP的出现是为了解决 ...

  7. printf和cout的区别详述

    https://blog.csdn.net/ysayk/article/details/50959909

  8. Paper Reviews and Presentations

    Copied from Advanced Computer Networks, Johns Hopkins University. Paper Reviews and Presentations Ea ...

  9. Git 提交的正确姿势:Commit message 编写指南

    http://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html Git 每次提交代码,都要写 Commit message( ...

  10. Vs Code搭建 TypeScript 开发环境

    一.npm install -g typescript 全局安装TypeScript   二.使用Vs Code打开已创建的文件夹,使用快捷键Ctrl+~启动终端输入命令 tsc --init 创建t ...