题意:

要生产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. git pull免密码拉取

    ssh到服务器上,原来基于public/private key pair的方法不好使了. 1.1 创建文件存储GIT用户名和密码 在%HOME%目录中,一般为C:\users\Administrato ...

  2. idea 安装findBugs 可以做代码扫描,也可以导出扫描结果生成扫描报告

    idea 安装findBugs 可以做代码扫描,也可以导出扫描结果生成扫描报告 https://my.oschina.net/viakiba/blog/1838296 https://www.cnbl ...

  3. Analyze Program Runtime Stack

    Introduce: Process Explorer is an advanced process management utility that picks up where Task Manag ...

  4. CSS滚动插件

    http://www.dowebok.com/131.html  wow.js http://www.jq22.com/jquery-info499 smoove.js http://www.lanr ...

  5. 51、如何提取android代码中的字符串为系统资源文件 (I18N)

    工具:android studio 步骤1:找到要转为资源文件的字符串并选中,同时按下option+enter,弹出菜单,我们选中extract string resource 步骤2:在弹窗中输入你 ...

  6. IOS笔记048-数据存储

      IOS数据存储的几种方式         XML属性列表(plist)         归档 Preference(偏好设置)          NSKeyedArchiver归档(NSCodin ...

  7. windows下SecureCRT无法使用Backspace(删除键)和上下左右键

    MongoDB Shell中退格键使用的问题. 利用SecureCRT工具访问linux的时候,在使用MongoDB的交互式shell的时候,退格键(Backspace)无法使用,导致无法修改输入的字 ...

  8. Python-S9-Day123——爬虫两示例

    01 今日内容回顾 02 内容回顾和补充:面向对象约束 03 爬虫之抽屉新热榜 04 爬虫之抽屉自动登录(一) 05 爬虫之抽屉自动登录(二) 06 爬虫之登录github(一) 07 爬虫之登录gi ...

  9. Python-S9——Day115-Flask Web框架

    01 当日内容概要 1 当日内容概要 1.1 Flask基础: 1.2 Web框架包含的基础组件: 1.2.1 路由.视图函数.模板渲染: 1.3 Flask配置文件: 1.4 Flask的路由系统: ...

  10. 【LeetCode】Remove Duplicates from Sorted List(删除排序链表中的重复元素)

    这道题是LeetCode里的第83道题. 题目描述: 给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次. 示例 1: 输入: 1->1->2 输出: 1->2 示例 2: ...