#K56732. Recommended Videos
Recommended Videos
Recommended Videos
You are given a list of users, a master list of available video titles, and for each user the list of videos they have watched. Your task is to recommend videos for each user by listing all videos they haven’t watched yet.
Formally, for each user u with watched set Wu and the set of all videos A, the recommended videos are given by the set difference $$A \setminus W_u = \{ x \;|\; x \in A \text{ and } x \notin W_u \}.$$
Read the input from stdin
and output the result to stdout
in the required format.
inputFormat
The input is read from stdin
as follows:
- The first line contains an integer
n
, the number of users. - The next
n
lines each contain a user name. - The following line contains an integer
m
, the number of all available videos. - The next
m
lines contain the video titles (one per line) in the order they appear. - Then, for each user (in the same order as given), there is a block:
- A line with an integer
k
, the number of videos the user has watched. - The next
k
lines each contain a title of a video the user has watched.
- A line with an integer
outputFormat
For each user (in the same order as input), output a single line in the following format:
username: recommended_video1 recommended_video2 ...
If a user has watched all videos, output the username followed by a colon with no videos listed.
## sample3
Alice
Bob
Charlie
6
Video1
Video2
Video3
Video4
Video5
Video6
3
Video1
Video2
Video3
2
Video2
Video4
3
Video1
Video4
Video5
Alice: Video4 Video5 Video6
Bob: Video1 Video3 Video5 Video6
Charlie: Video2 Video3 Video6
</p>