#P9806. [POI 2022/2023 R1] poc
[POI 2022/2023 R1] poc
Background
This problem is translated from POI2022~2023R1 poc.
Problem Description
Little A and Little B are recording the types of vehicles that passed by.
There are types in total, and every vehicle must belong to exactly one of them.
Little A carefully recorded the types of all vehicles in order, while playful Little B only recorded some of the vehicles in order.
The length of Little A’s record is , and the length of Little B’s record is .
We say that the -th vehicle in Little A’s record “may have been recorded by B” if and only if there exists a subsequence of Little A’s record that contains position and is exactly the same as the sequence recorded by Little B.
It is guaranteed that Little B’s sequence is a subsequence of Little A’s sequence. Determine which vehicles may have been recorded by Little B and which may not.
Input Format
The first line contains three integers .
The second line contains a sequence of length , representing the sequence recorded by Little A.
The third line contains a sequence of length , representing the sequence recorded by Little B.
All elements in the sequences satisfy sequence element .
Output Format
For each vehicle recorded by Little A, determine whether it can be recorded by Little B. Output if it can, and otherwise.
9 4 3
1 3 2 1 2 3 1 3 2
1 3 1 2
1 1 0 1 1 1 1 0 1
Hint
For the sample, the following subsequences exist:
, , , , .
Note that and are never chosen, so they cannot be recorded by Little B.
The subtasks are as follows:
| Subtask ID | Special Property | Score |
|---|---|---|
| Each vehicle type is recorded by Little A at most once | ||
| No additional constraints |
Time limit: Subtask 1 1s, Subtask 2 10s, Subtask 3 and Subtask 4 6s.
Translated by ChatGPT 5