/*
HDU 6000 - Wash [ 贪心 ]
题意:
L 件衣服,N 个洗衣机,M 个烘干机,给出每个洗衣机洗一件衣服的时间和烘干机烘干一件衣服的时间,问需要的最少时间是多少
分析:
先求出L件衣服最优洗衣时间的数组,再求出最优烘干时间的数组
然后排序按最小值+最大值的思路贪心,取最大值
可以看成排序后两数组咬合
*/
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 1e5+5;
const int MAXL = 1e6+5;
struct Node {
LL x; int y;
friend operator < (Node a, Node b) {
if (a.x == b.x) return a.y > b.y;
return a.x > b.x;
}
};
priority_queue<Node> Q;
int t, l, n, m;
int w[N], d[N];
LL a[MAXL], b[MAXL];
void solve(int w[], int n, LL a[])
{
while (!Q.empty()) Q.pop();
for (int i = 1; i <= n; i++) Q.push(Node{w[i], w[i]});
for (int i = 1; i <= l; i++)
{
Node tmp = Q.top(); Q.pop();
a[i] = tmp.x;
tmp.x += tmp.y;
Q.push(tmp);
}
}
int main()
{
scanf("%d", &t);
for (int tt = 1; tt <= t; tt++)
{
scanf("%d%d%d", &l, &n, &m);
for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
for (int i = 1; i <= m; i++) scanf("%d", &d[i]);
solve(w, n, a);
solve(d, m, b);
LL ans = 0;
for (int i = 1; i <= l; i++)
{
ans = max(ans, a[i] + b[l-i+1]);
}
printf("Case #%d: %lld\n", tt, ans);
}
}

  

HDU 6000 - Wash的更多相关文章

  1. HDU - 6000 Wash(优先队列+贪心)

    题意:已知有L件衣服,M个洗衣机,N个烘干机,已知每个机器的工作时间,且每个机器只能同时处理一件衣服,问洗烘完所有衣服所需的最短时间. 分析: 1.优先队列处理出每件衣服最早的洗完时间. 2.优先队列 ...

  2. 【HDU 6000】Wash(贪心)

    Problem Description Mr.Panda is about to engage in his favourite activity doing laundry! He's brough ...

  3. 【hdu 6000】Wash

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 因为每件衣服都是没有区别的. 只有洗衣机不同会影响洗衣时间. 那么我们把每台洗衣机洗衣的时间一开始都加入到队列中. 比如{2,3,6 ...

  4. CCPC 2016-2017, Finals

    A. HDU 5999 The Third Cup is Free 简单模拟. B. HDU 6000 Wash n 件衣服, m 个洗衣机,k 个烘干机.每个洗衣机和烘干机需要不同的时间.问 n 件 ...

  5. hdu6000 Wash ccpc-20162017-finals B Wash

    地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6000 题目: Wash Time Limit: 20000/10000 MS (Java/Ot ...

  6. HDU 1160 DP最长子序列

    G - FatMouse's Speed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64 ...

  7. hdu 3695:Computer Virus on Planet Pandora(AC自动机,入门题)

    Computer Virus on Planet Pandora Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 256000/1280 ...

  8. HDU 3695 Computer Virus on Planet Pandora(AC自动机模版题)

    Computer Virus on Planet Pandora Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 256000/1280 ...

  9. HDU 1160 FatMouse's Speed(要记录路径的二维LIS)

    FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

随机推荐

  1. 【转】MySQL中EXISTS的用法

    原文链接:https://www.cnblogs.com/qlqwjy/p/8598091.html 比如在Northwind数据库中有一个查询为 SELECT c.CustomerId,Compan ...

  2. 【已解决】每次打开Excel时会同时打开一个空的Excel表格

    每次打开Excel时会同时打开一个空的Excel表格,情况如图. 官方解法如下,本人验证有效: 方法1, 请到以后路径中检查是否存在与空白文件夹同名字的Excel文件,删除它. C:\Users\\A ...

  3. PB笔记之日期函数

    https://wenku.baidu.com/view/a0d5f16fb84ae45c3b358cc7.html this.object.yjzzrq[row]= RelativeDate(dat ...

  4. PowerBuilder学习笔记之2PowerScript语言(二)

    z教材地址:https://wenku.baidu.com/view/1e82d26925c52cc58ad6be05.html?sxts=1565679996440 2.4数组 声明数组:Integ ...

  5. 立体像对空间前方交会-点投影系数法(python实现)

    一.原理 二.步骤 a.用各自像片的角元素计算出左右像片的旋转矩阵R1和R2. b.根据左右像片的外方位元素计算摄影基线分量Bx,By,Bz. c.逐点计算像点的空间辅助坐标. d.计算投影系数. e ...

  6. python练习:面向对象1

    面向对象习题: 一:定义一个学生类.有下面的类属性: 1 姓名 2 年龄 3 成绩(语文,数学,英语)[每课成绩的类型为整数] 类方法: 1 获取学生的姓名:get_name() 返回类型:str 2 ...

  7. C++复制构造函数,类型转换构造函数,析构函数,引用,指针常量和常量指针

    复制构造函数形如className :: className(const &)   /   className :: className(const className &)后者能以常 ...

  8. Linux Exploit系列之三 Off-By-One 漏洞 (基于栈)

    Off-By-One 漏洞 (基于栈) 原文地址:https://bbs.pediy.com/thread-216954.htm 什么是off by one? 将源字符串复制到目标缓冲区可能会导致of ...

  9. springboot学习入门简易版三---springboot2.0启动方式

    2.4使用@componentscan方式启动 2.4.1 @EnableAutoConfiguration 默认只扫描当前类 @EnableAutoConfiguration 默认只扫描当前类,如果 ...

  10. Computer Vision_33_SIFT:A novel coarse-to-fine scheme for automatic image registration based on SIFT and mutual information——2014

    此部分是计算机视觉部分,主要侧重在底层特征提取,视频分析,跟踪,目标检测和识别方面等方面.对于自己不太熟悉的领域比如摄像机标定和立体视觉,仅仅列出上google上引用次数比较多的文献.有一些刚刚出版的 ...