题意:

要生产n个物品,每个花费时间为x。

有两种魔法,每种最多使用1个。

其中第一种魔法可以使每个物品生产的花费时间变为ai,相应的花费是bi;
第二种魔法可以减少ci个物品,相应的花费是di,并且保证对于i<j ci<=cj 且 di<=dj;

#include<bits/stdc++.h>
using namespace std;
long long b[],c[],d[];
pair<long long ,long long>a[];
long long inf=0x3f3f3f3f3f3f3f3f;
int main()
{
long long n,m,k,x,s;
scanf("%lld%lld%lld%lld%lld",&n,&m,&k,&x,&s);
for(int i=;i<=m;i++)scanf("%lld",&a[i].second);
for(int i=;i<=m;i++)scanf("%lld",&a[i].first);
for(int i=;i<=k;i++)scanf("%lld",c+i);
for(int i=;i<=k;i++)scanf("%lld",d+i);
long long ans=n*x;
sort(a+,a+m+);
int j=;
long long mina=x;
for(int i=k;i>=;i--){
while(j<=m&&a[j].first+d[i]<=s){
mina=min(mina,a[j].second);
j++;
}
if(d[i]<=s){
ans=min(ans,(n-c[i])*mina);
}
}
printf("%lld\n",ans);
}

Codeforces 734C [水][暴力][贪心]的更多相关文章

  1. Codeforces 913 二进制背包(柠檬水) 暴力贪心特殊背包(选题)

    A B C 给你N(N<=30)种水瓶每种水瓶有无限个 每个的体积是2^(i-1)价格是cost[i] 要求你花最少的钱弄出L体积的水 先从前到后扫一遍cost[i+1]=min(cost[i+ ...

  2. Codeforces Round #503 (by SIS, Div. 2) C. Elections (暴力+贪心)

    [题目描述] Elections are coming. You know the number of voters and the number of parties — n and m respe ...

  3. codeforces 704B - Ant Man 贪心

    codeforces 704B - Ant Man 贪心 题意:n个点,每个点有5个值,每次从一个点跳到另一个点,向左跳:abs(b.x-a.x)+a.ll+b.rr 向右跳:abs(b.x-a.x) ...

  4. 喵哈哈村的魔法考试 Round #1 (Div.2) 题解&源码(A.水+暴力,B.dp+栈)

    A.喵哈哈村的魔法石 发布时间: 2017年2月21日 20:05   最后更新: 2017年2月21日 20:06   时间限制: 1000ms   内存限制: 128M 描述 传说喵哈哈村有三种神 ...

  5. CodeForces - 50A Domino piling (贪心+递归)

    CodeForces - 50A Domino piling (贪心+递归) 题意分析 奇数*偶数=偶数,如果两个都为奇数,最小的奇数-1递归求解,知道两个数都为1,返回0. 代码 #include ...

  6. Codeforces Round #404 (Div. 2)(A.水,暴力,B,排序,贪心)

    A. Anton and Polyhedrons time limit per test:2 seconds memory limit per test:256 megabytes input:sta ...

  7. Codeforces 990 调和级数路灯贪心暴力 DFS生成树两子树差调水 GCD树连通块暴力

    A 水题 /*Huyyt*/ #include<bits/stdc++.h> #define mem(a,b) memset(a,b,sizeof(a)) using namespace ...

  8. Codeforces Beta Round #37 B. Computer Game 暴力 贪心

    B. Computer Game 题目连接: http://www.codeforces.com/contest/37/problem/B Description Vasya's elder brot ...

  9. Codeforces Round #407 (Div. 2)A B C 水 暴力 最大子序列和

    A. Anastasia and pebbles time limit per test 1 second memory limit per test 256 megabytes input stan ...

随机推荐

  1. A JavaScript Image Gallery

    childNodes property:  The childNodes property is a way of getting information about the children of ...

  2. Java集合---List、Set、Iterator、Map简介

    1.List集合 1.1概念 List继承自Collection接口.List是一种有序集合,List中的元素可以根据索引(顺序号:元素在集合中处于的位置信息)进行取得/删除/插入操作. 跟Set集合 ...

  3. input框中的必填项之取消当前input框为必填项

    html5新增了一个required属性,可以使用这个属性对文本框设置必填项,直接在input文本框上添加required即可 . 效果如图:   

  4. 剖析微软Hyper-V的最佳部署方式

    剖析微软Hyper-V的最佳部署方式 2014-04-24 10:53 布加迪编译 51CTO.com 字号:T | T 微软Hyper-V有两种不同的版本.既可以安装到Windows Server的 ...

  5. CSS视觉格式化模型

    CSS视觉格式化模型(visual formatting model)是用来处理文档并将它显示在视觉媒体上的机制.这是CSS 2.1的一个基础概念.视觉格式化模型根据CSS盒模型为文档的每个元素生成0 ...

  6. PostgreSQL 如何优化索引效率

    使用 gin() 创建全文索引后,虽然有走索引,但是当结果集很大时,查询效率还是很底下, SELECT keyword,avg_mon_search,competition,impressions,c ...

  7. Python面向对象之常用的特殊方法(5)

    Python面向对象里面有很多特殊方法,例如__init__(构造方法),__del__(析构方法),这些方法对于面向对象编程非常重要,下面列出一些常用的特殊方法 (1)__call__ class ...

  8. java 课堂笔记

  9. JVM虚拟机系列(三)Class文件格式

  10. github 下载部分文件夹

    1.下载svn: 记得勾上: 2.配置环境变量,将svn的bin目录添加到环境变量 3.svn checkout [链接](你的下载的项目地址) 不过,注意,要改一下哦: 比如我要下载todo项目里的 ...