欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1152A.Neko Finds Grapes
Neko Finds Grapes
On a random day, Neko found treasure chests and keys. The -th chest has an integer written on it and the -th key has an integer on it. Neko knows those chests contain the powerful mysterious green Grapes, thus Neko wants to open as many treasure chests as possible.
The -th key can be used to unlock the -th chest if and only if the sum of the key number and the chest number is an odd number. Formally, . One key can be used to open at most one chest, and one chest can be opened at most once.
Find the maximum number of chests Neko can open.
Input
The first line contains integers and () — the number of chests and the number of keys.
The second line contains integers () — the numbers written on the treasure chests.
The third line contains integers () — the numbers written on the keys.
Output
Print the maximum number of chests you can open.
Note
In the first example, one possible way to unlock chests is as follows:
- Use first key to unlock the fifth chest,
- Use third key to unlock the second chest,
- Use fourth key to unlock the first chest.
In the second example, you can use the only key to unlock any single chest (note that one key can't be used twice).
In the third example, no key can unlock the given chest.
Samples
5 4
9 14 6 2 11
8 4 7 20
3
5 1
2 4 6 8 10
5
1
1 4
10
20 30 40 50
0
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |