欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF2051C.Preparing for the Exam
Preparing for the Exam
Monocarp is preparing for his first exam at the university. There are different questions which can be asked during the exam, numbered from to . There are different lists of questions; each list consists of exactly different questions. Each list is characterized by one integer , which is the index of the only question which is not present in the -th list. For example, if and , the -th list contains questions .
During the exam, Monocarp will receive one of these lists of questions. Then, the professor will make Monocarp answer all questions from the list. So, Monocarp will pass only if he knows all questions from the list.
Monocarp knows the answers for questions . For each list, determine if Monocarp will pass the exam if he receives that list.
Input
The first line contains one integer () — the number of test cases.
Each test case consists of three lines:
- the first line contains three integers , and (; );
- the second line contains distinct integers (; );
- the third line contains distinct integers (; ).
Additional constraints on the input:
- the sum of over all test cases does not exceed .
Output
For each test case, print a string of characters. The -th character should be 1 if Monocarp passes the exam if he receives the -th question list, 0 if Monocarp won't pass.
Note
In the first test case, Monocarp knows the questions . Let's consider all the question lists:
- the first list consists of questions . Monocarp doesn't know the -nd question, so he won't pass;
- the second list consists of questions . Monocarp knows all these questions, so he will pass;
- the third list consists of questions . Monocarp doesn't know the -nd question, so he won't pass;
- the fourth list consists of questions . Monocarp doesn't know the -nd question, so he won't pass.
Samples
4
4 4 3
1 2 3 4
1 3 4
5 4 3
1 2 3 4
1 3 4
4 4 4
1 2 3 4
1 2 3 4
2 2 1
1 2
2
0100
0000
1111
10
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |