题意:

要生产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. 批处理文件执行cmd命令

    @echo offstart "wumin" "C:\Windows\System32\cmd.exe" osk taskkill /f /im cmd.exe ...

  2. Marketing learning-1

    Today we start to learn something about marketing together.Sometimes i just propose a question,and i ...

  3. C语言其他知识总结

    1.常指针与指针常量 诀窍:观察const修饰的是谁,那谁就不可更改. const int *p;//const 修饰*p,所以*p不能更改.通过指针不可更改指向的值 int const *p;//同 ...

  4. 设计模式之责任链模式 chainOfResp

    后面我们将学习设计模式里面的行为型模式 代码实现 /** * 抽象类 * @author bzhx * 2017年3月14日 */ public abstract class Leader { pro ...

  5. Leetcode 654.最大二叉树

    最大二叉树 给定一个不含重复元素的整数数组.一个以此数组构建的最大二叉树定义如下: 二叉树的根是数组中的最大元素. 左子树是通过数组中最大值左边部分构造出的最大二叉树. 右子树是通过数组中最大值右边部 ...

  6. 关于可图化序列的一点结论 NEU 1429

    Graphic Sequence A graphic sequence is a sequence of numbers which can be the degree sequence of som ...

  7. Manthan, Codefest 16 B 数学

    B. A Trivial Problem time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  8. iOS中block 静态全局局部变量block变量,以及对象,详解!

    //最近总是犯迷糊,关于block对外部变量的引用,今天有时间就写了一下,加深自己的理解,巩固基础知识 1 #import <Foundation/Foundation.h> ; int ...

  9. 2017最好的JavaScript框架、库和工具 — SitePoint

    与开发者数量相比,可能有更多的JavaScript框架.库和工具.截止到2017年5月,在GitHub上快速搜索能搜到超过110万的JavaScript项目. 在npmjs上有50万的可用包,并且这些 ...

  10. Http 请求头 Range

    HTTP 请求头 Range 请求资源的部分内容(不包括响应头的大小),单位是byte,即字节,从0开始. 如果服务器能够正常响应的话,服务器会返回 206 Partial Content 的状态码及 ...