A1287 | [COCI-2013_2014-contest1]#2 LOPOV
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
The difficult economic situation in the country and reductions in government agricultural subsidy funding have caused Mirko to change his career again, this time to a thief. His first professional endeavour is a jewellery store heist.
The store contains N pieces of jewellery, and each piece has some mass Mi and value Vi . Mirko has K bags to store his loot, and each bag can hold some maximum mass Ci . He plans to store all his loot in these bags, but at most one jewellery piece in each bag, in order to reduce the likelihood of damage during the escape.
Find the maximum total jewellery value that Mirko can “liberate”.
The store contains N pieces of jewellery, and each piece has some mass Mi and value Vi . Mirko has K bags to store his loot, and each bag can hold some maximum mass Ci . He plans to store all his loot in these bags, but at most one jewellery piece in each bag, in order to reduce the likelihood of damage during the escape.
Find the maximum total jewellery value that Mirko can “liberate”.
输入格式
The first line of input contains two numbers, N and K (1 ≤ N, K ≤ 300 000).
Each of the following N lines contains a pair of numbers, Mi and Vi (1 ≤ Mi , Vi ≤ 1 000 000).
Each of the following K lines contains a number, Ci (1 ≤ Ci ≤ 100 000 000).
All numbers in the input are positive integers.
Each of the following N lines contains a pair of numbers, Mi and Vi (1 ≤ Mi , Vi ≤ 1 000 000).
Each of the following K lines contains a number, Ci (1 ≤ Ci ≤ 100 000 000).
All numbers in the input are positive integers.
输出格式
The first and only line of output must contain the maximum possible total jewellery value.
输入输出样例
输入 #1
2 1 5 10 100 100 11
输出 #1
10
输入 #2
3 2 1 65 5 23 2 99 10 2
输出 #2
164
In test data worth at least 50% of total points, N and K will be less than 5000.
Clarification of the second example: Mirko stores the first piece of jewellery into the second bag and
the third piece into the first bag.
Clarification of the second example: Mirko stores the first piece of jewellery into the second bag and
the third piece into the first bag.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted