QOJ.ac

QOJ

时间限制: 4 s 内存限制: 512 MB 总分: 100 可 Hack ✓

#85. Sparse XOR Convolution

统计

Given $n, m, k$ and $m$ pairs of sequences $(a_i, b_i)$, where $|a_i|=|b_i|=d_i$, for all $0\leq t < 2^n$, calculate: $$ S_t=\sum_{c \in C_t}\prod_{i=1}^m b_{i,c_i} \pmod {10^{18}+125953} $$

where $C_t$ is the set of all sequences $c$ such that $1\leq c_i\leq d_i$ and $\oplus_{i=1}^m a_{i,c_i}=t$.

Input

The first line contains three positive integers $n, m, k$.

Then, $F_1, \dots, F_m$ are input sequentially.

For each $F_i$:

The first line contains a positive integer $d_i$.

The next line contains $d_i$ non-negative integers $a_{i,j}$.

The next line contains $d_i$ positive integers $b_{i,j}$.

Output

Output $2^n$ integers $S_0, \dots, S_{2^n-1}$ on a single line.

Examples

Input 1

4 3 4
3
5 1 4
1 1 4
4
8 2 7 3
11 13 9 6
4
10 0 2 2
7 9 8 3

Output 1

165 539 135 518 737 407 911 410 105 442 0 121 865 358 484 121

Constraints

$1\leq n \leq 20$, $1\leq d_i\leq k\leq 10$, $\sum_i 2^{d_i}\leq 2^{17}$, $0\leq a_{i,j}<2^n$, $1\leq b_{i,j} < P$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.