CF355B.Vasya and Public Transport
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Vasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has n buses and m trolleys, the buses are numbered by integers from 1 to n, the trolleys are numbered by integers from 1 to m.
Public transport is not free. There are 4 types of tickets:
- A ticket for one ride on some bus or trolley. It costs _c_1 burles;
- A ticket for an unlimited number of rides on some bus or on some trolley. It costs _c_2 burles;
- A ticket for an unlimited number of rides on all buses or all trolleys. It costs _c_3 burles;
- A ticket for an unlimited number of rides on all buses and trolleys. It costs _c_4 burles.
Vasya knows for sure the number of rides he is going to make and the transport he is going to use. He asked you for help to find the minimum sum of burles he will have to spend on the tickets.
瓦西里经常乘坐公共交通工具。该城市的公共交通工具有两种类型:无轨电车和公共汽车。城市共有 n 辆公共汽车和 m 辆无轨电车,公共汽车编号为 1 到 n 的整数,无轨电车编号为 1 到 m 的整数。
公共交通并非免费。共有 4 种车票:
- 一张可在某辆公共汽车或某辆无轨电车上乘坐一次的车票,价格为 c1 卢布;
- 一张可在某辆公共汽车或某辆无轨电车上无限次乘坐的车票,价格为 c2 卢布;
- 一张可在所有公共汽车或所有无轨电车上无限次乘坐的车票,价格为 c3 卢布;
- 一张可在所有公共汽车和无轨电车上无限次乘坐的车票,价格为 c4 卢布。
瓦西里确切地知道自己将乘坐的次数以及所使用的交通工具类型。他请你帮忙计算他购买车票所需支付的最少卢布总额。
输入格式
The first line contains four integers _c_1, _c_2, _c_3, _c_4 (1 ≤ _c_1, _c_2, _c_3, _c_4 ≤ 1000) — the costs of the tickets.
The second line contains two integers n and m (1 ≤ n, m ≤ 1000) — the number of buses and trolleys Vasya is going to use.
The third line contains n integers a__i (0 ≤ a__i ≤ 1000) — the number of times Vasya is going to use the bus number i.
The fourth line contains m integers b__i (0 ≤ b__i ≤ 1000) — the number of times Vasya is going to use the trolley number i.
第一行包含四个整数 c1、c2、c3、c4(1≤c1,c2,c3,c4≤1000)—— 分别表示四种车票的费用。
第二行包含两个整数 n 和 m(1≤n,m≤1000)—— 分别表示瓦夏将要乘坐的公交车数量和无轨电车数量。
第三行包含 n 个整数 ai(0≤ai≤1000)—— 表示瓦夏将乘坐第 i 辆公交车的次数。
第四行包含 m 个整数 bi(0≤bi≤1000)—— 表示瓦夏将乘坐第 i 辆无轨电车的次数。
输出格式
Print a single number — the minimum sum of burles Vasya will have to spend on the tickets.
输出一个整数——Vasya 购买车票所需花费的 burles 的最小总和。
输入输出样例
输入#1
1 3 7 19 2 3 2 5 4 4 4
输出#1
12
输入#2
4 3 2 1 1 3 798 1 2 3
输出#2
1
输入#3
100 100 8 100 3 5 7 94 12 100 1 47 0 42
输出#3
16
说明/提示
In the first sample the profitable strategy is to buy two tickets of the first type (for the first bus), one ticket of the second type (for the second bus) and one ticket of the third type (for all trolleys). It totals to (2·1) + 3 + 7 = 12 burles.
In the second sample the profitable strategy is to buy one ticket of the fourth type.
In the third sample the profitable strategy is to buy two tickets of the third type: for all buses and for all trolleys.
在第一个样例中,盈利的策略是购买两张第一种类型的车票(用于第一辆公交车)、一张第二种类型的车票(用于第二辆公交车)以及一张第三种类型的车票(用于所有电车)。总费用为 (2⋅1) + 3 + 7 = 12 布尔。
在第二个样例中,盈利的策略是购买一张第四种类型的车票。
在第三个样例中,盈利的策略是购买两张第三种类型的车票:一张用于所有公交车,另一张用于所有电车。
输入解题思路,AI测评打分。不知道怎么写?