9/2/25, 10:28 AM Problem - 2051C - Codeforces
|
stdfloat | Logout
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN
PROBLEMS SUBMIT STATUS STANDINGS CUSTOM TEST
Codeforces Round 995 (Div. 3)
C. Preparing for the Exam Finished
time limit per test: 1.5 seconds Practice
memory limit per test: 256 megabytes
Monocarp is preparing for his first exam at the university. There are n different questions which can be asked during
the exam, numbered from 1 to n . There are m different lists of questions; each list consists of exactly n − 1
different questions. Each list i is characterized by one integer ai , which is the index of the only question which is → Virtual participation
not present in the i -th list. For example, if n = 4 and ai = 3, the i -th list contains questions [1, 2, 4] . Virtual contest is a way to take part in past contest,
as close as possible to participation on time. It is
During the exam, Monocarp will receive one of these m lists of questions. Then, the professor will make Monocarp supported only ICPC mode for virtual contests. If
you've seen these problems, a virtual contest is not
answer all questions from the list. So, Monocarp will pass only if he knows all questions from the list. for you - solve these problems in the archive. If you
just want to solve some problem from a contest, a
virtual contest is not for you - solve this problem in
Monocarp knows the answers for k questions q1 , q2 , … , qk . For each list, determine if Monocarp will pass the the archive. Never use someone else's code, read
exam if he receives that list. the tutorials or communicate with other person
during a virtual contest.
Input Start virtual contest
4
The first line contains one integer t (1 ≤ t ≤ 10 ) — the number of test cases.
Each test case consists of three lines: → Clone Contest to Mashup
5
the first line contains three integers n , m and k (2 ≤ n ≤ 3 ⋅ 10 ; 1 ≤ m, k ≤ n);
the second line contains m distinct integers a1 , a2 , … , am (1 ≤ ai ≤ n ; ai < ai+1 ); → Submit?
the third line contains k distinct integers q1 , q2 , … , qk (1 ≤ qi ≤ n ; qi < qi+1 ).
Language: GNU G++20 13.2 (64 bit, winlibs)
Additional constraints on the input:
Choose
Choose File No file chosen
the sum of n over all test cases does not exceed 3 ⋅ 10 .
5 file:
Submit
Output
For each test case, print a string of m characters. The i -th character should be 1 if Monocarp passes the exam if
he receives the i -th question list, 0 if Monocarp won't pass.
→ Contest materials
Example
Announcement
input Copy
Tutorial
4
4 4 3
1 2 3 4
1 3 4 → CF GetRating
5 4 3
1 2 3 4
*1000
1 3 4
4 4 4
Show All Tags
1 2 3 4
1 2 3 4 Contest Standings
2 2 1
1 2
2
output Copy
0100
0000
1111
10
Note
In the first test case, Monocarp knows the questions [1, 3, 4] . Let's consider all the question lists:
the first list consists of questions [2, 3, 4] . Monocarp doesn't know the 2 -nd question, so he won't pass;
the second list consists of questions [1, 3, 4] . Monocarp knows all these questions, so he will pass;
the third list consists of questions [1, 2, 4] . Monocarp doesn't know the 2 -nd question, so he won't pass;
the fourth list consists of questions [1, 2, 3] . Monocarp doesn't know the 2 -nd question, so he won't pass.
Codeforces (c) Copyright 2010-2025 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Sep/02/2025 10:27:42UTC+5 (h1).
Desktop version, switch to mobile version.
Privacy Policy | Terms and Conditions
Supported by
https://codeforces.com/problemset/problem/2051/C 1/2
9/2/25, 10:28 AM Problem - 2051C - Codeforces
https://codeforces.com/problemset/problem/2051/C 2/2