Sum of Intersection Sizes
InterviewTime limit4sMemory limit1024 MB
Given N sets, find for each k the sum of intersection sizes over all ways to pick k of the sets, modulo 998244353.
- Level
Medium5 of 10
- Topics
- Combinatorics, Hash map
- Solved
- No attempts yet
Problem
You are given sets .
For each , choose of the sets among and take the size of their intersection. is the sum of these intersection sizes over all ways to choose the sets. In formula form:
For every , find modulo . is prime.
Input
The first line contains an integer . ()
The next lines describe the sets. The -th of these lines contains space-separated integers in the following format.
- The first number is . ()
- The next numbers are the elements of , , given in ascending order. ()
The sum of all set sizes does not exceed . That is, .
Output
Print lines. On line , print modulo for each .