欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1121A.Technogoblet of Fire
Technogoblet of Fire
Everybody knows that the -coder Tournament will happen soon. schools participate in the tournament, and only one student from each school participates.
There are a total of students in those schools. Before the tournament, all students put their names and the names of their schools into the Technogoblet of Fire. After that, Technogoblet selects the strongest student from each school to participate.
Arkady is a hacker who wants to have Chosen Ones selected by the Technogoblet. Unfortunately, not all of them are the strongest in their schools, but Arkady can make up some new school names and replace some names from Technogoblet with those. You can't use each made-up name more than once. In that case, Technogoblet would select the strongest student in those made-up schools too.
You know the power of each student and schools they study in. Calculate the minimal number of schools Arkady has to make up so that Chosen Ones would be selected by the Technogoblet.
Input
The first line contains three integers , and (, ) — the total number of students, the number of schools and the number of the Chosen Ones.
The second line contains different integers (), where denotes the power of -th student. The bigger the power, the stronger the student.
The third line contains integers (), where denotes the school the -th student goes to. At least one student studies in each of the schools.
The fourth line contains different integers () — the id's of the Chosen Ones.
Output
Output a single integer — the minimal number of schools to be made up by Arkady so that Chosen Ones would be selected by the Technogoblet.
Note
In the first example there's just a single Chosen One with id . His power is equal to , but in the same school , there's a student with id and power , and that means inaction would not lead to the latter being chosen. If we, however, make up a new school (let its id be ) for the Chosen One, Technogoblet would select students with ids (strongest in ), (strongest in ), (strongest in ) and (strongest in ).
In the second example, you can change the school of student to the made-up and the school of student to the made-up . It will cause the Technogoblet to choose students , , , , and .
Samples
7 3 1
1 5 3 4 6 7 2
1 3 1 2 1 2 3
3
1
8 4 4
1 2 3 4 5 6 7 8
4 3 2 1 4 3 2 1
3 4 5 6
2
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |