CodeForces 734C - Anton and Making Potions(枚举)

U8采购入库单CO接口开发实战:加载、新增与删除操作详解 本文详细解析了用友U8采购入库单CO接口的开发实战,重点介绍了加载、新增与删除三大核心操作的实现方法。通过C#代码示例和实际项目经验,帮助开发者高效处理采购入库单,提升企业供应链管理效率。文章还涵盖了环境配置、异常处理、性能优化等关键技巧,适合U8二次开发人员参考。 阅读详情

C. Anton and Making Potions
time limit per test4 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potions.

Anton has a special kettle, that can prepare one potions in x seconds. Also, he knows spells of two types that can faster the process of preparing potions.

Spells of this type speed up the preparation time of one potion. There are m spells of this type, the i-th of them costs bi manapoints and changes the preparation time of each potion to ai instead of x.
Spells of this type immediately prepare some number of potions. There are k such spells, the i-th of them costs di manapoints and instantly create ci potions.
Anton can use no more than one spell of the first type and no more than one spell of the second type, and the total number of manapoints spent should not exceed s. Consider that all spells are used instantly and right before Anton starts to prepare potions.

Anton wants to get to the next level as fast as possible, so he is interested in the minimum number of time he needs to spent in order to prepare at least n potions.

Input
The first line of the input contains three integers n, m, k (1 ≤ n ≤ 2·109, 1 ≤ m, k ≤ 2·105) — the number of potions, Anton has to make, the number of spells of the first type and the number of spells of the second type.

The second line of the input contains two integers x and s (2 ≤ x ≤ 2·109, 1 ≤ s ≤ 2·109) — the initial number of seconds required to prepare one potion and the number of manapoints Anton can use.

The third line contains m integers ai (1 ≤ ai < x) — the number of seconds it will take to prepare one potion if the i-th spell of the first type is used.

The fourth line contains m integers bi (1 ≤ bi ≤ 2·109) — the number of manapoints to use the i-th spell of the first type.

There are k integers ci (1 ≤ ci ≤ n) in the fifth line — the number of potions that will be immediately created if the i-th spell of the second type is used. It’s guaranteed that ci are not decreasing, i.e. ci ≤ cj if i < j.

The sixth line contains k integers di (1 ≤ di ≤ 2·109) — the number of manapoints required to use the i-th spell of the second type. It’s guaranteed that di are not decreasing, i.e. di ≤ dj if i < j.

Output
Print one integer — the minimum time one has to spent in order to prepare n potions.

Examples
input
20 3 2
10 99
2 4 3
20 10 40
4 15
10 80
output
20
input
20 3 2
10 99
2 4 3
200 100 400
4 15
100 800
output
200
Note
In the first sample, the optimum answer is to use the second spell of the first type that costs 10 manapoints. Thus, the preparation time of each potion changes to 4 seconds. Also, Anton should use the second spell of the second type to instantly prepare 15 potions spending 80 manapoints. The total number of manapoints used is 10 + 80 = 90, and the preparation time is 4·5 = 20 seconds (15 potions were prepared instantly, and the remaining 5 will take 4 seconds each).

In the second sample, Anton can’t use any of the spells, so he just prepares 20 potions, spending 10 seconds on each of them and the answer is 20·10 = 200.

题意:
要造n瓶毒药,每瓶需要x时间。但是你有s点魔力值。m个一类魔法,k个二类魔法。
一类魔法能改变制造的时间,二类魔法能直接产生一些毒药。
但是每一类最多只能使用一个。
问最小的时间。

解题思路:
枚举第一类魔法,在第一种魔法的条件下找出不大于当前魔力值的,消耗最多的第二类魔法(因为第二类魔法的功效和消耗都是非递减的,因此用二分去做)。
AC代码:

#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int a_time[maxn];
int a_cost[maxn];
int b_make[maxn];
int b_cost[maxn];
int main()
{
    int n,m,k;
    int x,s;
    cin>>n>>m>>k>>x>>s;
    for(int i = 1;i <= m;i++)   cin>>a_time[i];
    for(int i = 1;i <= m;i++)   cin>>a_cost[i];
    for(int i = 1;i <= k;i++)   cin>>b_make[i];
    for(int i = 1;i <= k;i++)   cin>>b_cost[i];
    a_time[0] = x;
    a_cost[0] = 0;
    long long ans = 1LL*n*x;
    for(int i = 0;i <= m;i++)
    {
        if(a_cost[i] > s)   continue;
        int index = upper_bound(b_cost,b_cost+k+1,s-a_cost[i])-b_cost;
        long long tmp = 1LL*(n-b_make[index-1])*a_time[i];
        ans = min(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}
2、瑞丽-伯纳德对流的拉格朗日拟序结构(FTLE场结果对比) 在中,我简单比较了瑞丽伯纳德对流的FTLE场,但是因为粒子追踪采用的是欧拉方法,所以精度不是很高, 因此与文献中的结果还是有些差别。下面放一张文献中的FTLE场,参数与上篇文章是一致的,Ra = 1e8;Pr = 1;本文将详细的介绍如何得到这样的图片,好吧,其实也不是很详细。总之,先展示以下我个人的结果。可以看出,上图基本上与文献是一致的,因为这里展示的是瞬时场,所以当然不可能是完全一致,至于提取的LCS结构,我在下面也会提及。本着详细介绍的原则,所以这里我很良心的从流场计算开始介绍。 阅读详情

相关推荐

Hyper-V集群部署指南

工欲善其事,必先利其器。搭建一个方便管理的服务集群,是分布式学习很重要的环境。 目前流行的虚拟机产品主要为Vmware 和 win10自带的Hyper-V(win10家庭版无此功能),网上关于Vmware的教程更多,显然它更容易上手,但Hyper-V也算是一个很不错的产品,这里记录一下我的学习过程: 目录 Hyper-V的安装 服务集群的搭建 虚拟机的网络通信 NAT网络的搭建 端口映射 Linux的静态IP 虚拟机的自启动问题 Hyper-V的安装 也不能算说是安装,如果你的win1

Swing 6931

CodeForces - 734C Anton and Making Potions 二分+贪心 思维题

题意:有n件物品要完成,完成每件物品的时间是x。有两种buff。第一种有m个,每个消耗bi法力值,可以使制作时间变为ai。第二种有k个,每个消耗法力值di,可以瞬间完成ci个物品。现在你有s点法力值,每种buff最多只能使用一个。求最少的完成时间。 题解:枚举第一种buff,然后二分搜索s-bi。因为第二种buff的法力值和完成件数是升序的,可以直接进行二分。

ACZone 391

第十篇|网络子系统 ②——无损以太网、PFC/ECN、DCQCN 与拥塞可视化

网络部分了解了解

qq_37535542的博客 1883

二分算法题目训练(三)——Anton and Making Potions详解

二分算法题目训练(三)——Anton and Making Potions详解 codeforces734C——Anton and Making Potions详解 Anton and Making Potions 题目描述(google翻译) 安东正在玩一个非常有趣的电脑游戏,但现在他被困在其中一个级别。为了进入下一个级别...

Nikki_o3o的博客 335

无人机开发平台全解析:从开源飞控到企业级应用实战指南

无人机开发平台是无人机从飞行器演变为智能空中机器人的核心,其本质是提供了一套标准化的软硬件接口与工具链,使开发者能够基于稳定可靠的底层系统,专注于上层应用创新。从技术原理上看,一个完整的开发平台通常包含飞行控制器、机载计算机、传感器套件等硬件层,以及飞控固件、机器人操作系统(ROS/ROS 2)、软件开发套件(SDK)等软件层,通过分层架构实现飞行控制、感知决策与任务执行的解耦。其技术价值在于大幅降低了无人机行业应用的开发门槛,使开发者无需从零构建飞行控制系统,即可快速实现自动巡检、精准农业、物流配送等复杂

weixin_28712491的博客 416

相机图像质量研究(15)常见问题总结:光学结构对成像的影响--暗角

老式相机的暗角往往比较明显,周围一圈能够明显感觉到亮度下降的很多,当然有些电源模仿手持相机的摄影效果,也能看到周围明显的亮度下降。一、

xiaoshixiu的专栏 1130

CodeForces 734C Anton and Making Potions 二分或线段树

题意: 你要制作n个药,初始制作一个药的时间为x,魔力值为s,有两类咒语可以加速,一类有m种咒语,每种咒语使制作一个药的时间变成a[i],花费b[i]的魔力,二类有k种咒语,每种咒语瞬间产生c[i]个药,花费d[i]的魔力,c[i]和d[i]都是不递减的,求最短时间内产生n个药的时间。 思路: 题目中明确说明了,对于第二类咒语,魔力值花的越多,瞬间产生的药也越多。所以我们可以枚举第一种咒语,

DT2131 580

R语言笔记十:独立性检验函数

1.独立性检验函数        独立性检验是根据频数信息判断两类因子彼此相关或相互独立的假设检验。所谓独立性就是指变量之间是独立的,没有关系。 独立性检验算法:卡方检验、Fisher检验、Cochran-Mantel-Haenszel检验 2.假设检验 假设检验(Hypothesis Testing)是数理统计学中根据一定假设条件由样本推断总体的一种方法。 原假设——没有发生 备择假设——发生了 具体做法:根据问题的需要对所研究的总体作

weixin_44384631的博客 4113

Codeforces 734C Anton and Making Potions(二分)

C. Anton and Making Potions time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Anton is playing a very interes

Chunzhen的博客 1255

【SAP报错】BK128&K5112

在ECC中使用CO1F进行Progressive confirmation时,依次遇到了如下的报错。

weixin_45228526的博客 794

【用unity实现100个游戏之7】实现一个类《杀戮尖塔》的卡牌回合制游戏(附项目源码)

【用unity实现100个游戏之7】实现一个类《杀戮尖塔》的卡牌回合制游戏(附项目源码)

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 1万+

Anton and Making Potions

Anton and Making Potions time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Anton is playing a very interesting comput...

weixin_30586257的博客 173

从 SAP GUI 走向 SAP Fiori:一套面向 SAP S/4HANA 的用户迁移实战方法论

SAP S/4HANA转型中,用户从SAP GUI迁移到Fiori的难点在于业务价值的重构而非简单的界面替换。Fiori的核心价值在于角色化、实时洞察和智能决策,而非完全替代GUI。成功迁移需分阶段推进:先展示关键角色的价值,建立统一入口,再逐步提高Fiori占比。让用户参与设计比后期培训更重要,需通过具体场景(如采购优先级管理)展示效率提升。迁移策略应平衡新旧界面优势,让Fiori成为业务价值触达的主要方式,而非强制替换。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 246

Codeforces 734C. Anton and Making Potions (枚举 + 二分)

Description Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potions. Anton has a special kettle, that can prepare one potions in x seconds. Also, he knows spells of

chr1stopher 310

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

CodeForces - 734C Anton and Making Potions(二分+枚举)

Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potions. Anton has a special kettle, that can prepare one

LLL_yx的博客 436

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Codeforces-734C-Anton and Making Potions(枚举+二分)

C. Anton and Making Potions time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton is playing a very interesting computer game, but now he

Prim 618

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Codeforces 734C Anton and Making Potions(枚举+二分)

题目链接:http://codeforces.com/problemset/problem/734/C 题目大意:要制作n个药,初始制作一个药的时间为x,魔力值为s,有两类咒语,第一类周瑜有m种,每种咒语使制作一个药的时间变成a[i],花费b[i]的魔力,第二类咒语有k种,每种咒语瞬间产生c[i]个药,花费d[i]的魔力,c[i]和d[i]都是不递减的,求最短时间内产生n个药的时间。解...

weixin_30242907的博客 129

【13.77%】【codeforces 734C】Anton and Making Potions

time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton is playing a very interesting computer game, but now he is stuck at on...

AWCXV 137

734C Anton and Making Potions

题目链接:http://codeforces.com/problemset/problem/734/C题解:题目大意: 一个人升级需要n瓶药,这个人会两种魔法,第一种魔法可以缩减炼药的时间,另一种可以瞬间完成一些药。一瓶药在没有释放任何魔法的情况下,炼制的时间为x,并且,这个人所拥有的法力值为s,但是一个人最多每种魔法使用一次(注意不是每个),问你炼制这些药的最小的时间是多少。 这道题的数据的范

silver_bone的博客 330

CodeForces - 734C Anton and Making Potions (二分)

题目链接;http://codeforces.com/problemset/problem/734/C点击打开链接 C. Anton and Making Potions time limit per test 4 seconds memory limit per test 256 megabytes input standard input

xuejye的博客 442

CodeForces - 734C Anton and Making Potions(二分)

CodeForces - 734C   Anton and Making Potions题目:有n个药剂需要制作,制作每个药剂需要time秒钟,并且最初有w的能量;魔法师现在有两种催化剂,第一种可以消耗fc[i]的能量,使得所有药剂的所需时间变为fw[i];第二种消耗能量sc[i],使得sw[i]个数的药剂瞬间制作好;但两种催化剂每种只能最多选择一种,问最后最少需要多少时间;思路:注意到第二种的催...

GYH0730的博客 378

codeforces - 734C - Anton and Making Potions(二分)

codeforces - 734C - Anton and Making Potions(二分)LINK:http://codeforces.com/contest/734/problem/C题意: 要做n瓶药水。 有两种方法加速,第一种方法是把每剂药剂的生成时间变为ai,费用为bi,第二种方法是立刻生成ci个药剂,费用为di。 求最快的,在花费在s以内的方法。(题目保证c递增,d递增)解法:

horihori_的博客 437

C - Anton and Making Potions CodeForces - 734C(二分)

Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potions. Anton has a special kettle, that can prepare one pot...

tomjobs的博客 390

Codeforces 734C. Anton and Making Potions(二分)

Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to preparenpotions. Anton has a special kettle, that can prepare ...

awow80285的博客 140

【Codeforces 734 C Anton and Making Potions 】+ 思维

C. Anton and Making Potions time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard outputAnton is playing a very interesting computer game, but n

楚江枫 761

Codeforces-734C-Anton and Making Potions(思维+二分)

题目:戳一戳 题解:哎,当时真没想到会要二分啊,不过加深了自己对lower_bound跟upper_bound的理解,先找到直接生成的。然后通过暴力(结合二分)去求解。 代码: #include<bits/stdc++.h> #define LL long long #define N 200005 using namespace std; int m,k; LL n,x,s,...

Rotepad的博客 255
上一篇: PAT (Advanced Level) 1003 - Emergency(单元最短路)
下一篇: PAT(Advanced Level) 1004 - Counting Leaves(树)
Snakeflute
博客等级 码龄11年 14粉丝 172原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值