A12422 | Triple
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You have received your birthday gifts — $n$ triples of integers! The $i$ -th of them is $\lbrace a_{i}, b_{i}, c_{i} \rbrace$ . All numbers are greater than or equal to $0$ , and strictly smaller than $2^{k}$ , where $k$ is a fixed integer.
One day, you felt tired playing with triples. So you came up with three new integers $x$ , $y$ , $z$ , and then formed $n$ arrays. The $i$ -th array consists of $a_i$ repeated $x$ times, $b_i$ repeated $y$ times and $c_i$ repeated $z$ times. Thus, each array has length $(x + y + z)$ .
You want to choose exactly one integer from each array such that the XOR (bitwise exclusive or) of them is equal to $t$ . Output the number of ways to choose the numbers for each $t$ between $0$ and $2^{k} - 1$ , inclusive, modulo $998244353$ .
One day, you felt tired playing with triples. So you came up with three new integers $x$ , $y$ , $z$ , and then formed $n$ arrays. The $i$ -th array consists of $a_i$ repeated $x$ times, $b_i$ repeated $y$ times and $c_i$ repeated $z$ times. Thus, each array has length $(x + y + z)$ .
You want to choose exactly one integer from each array such that the XOR (bitwise exclusive or) of them is equal to $t$ . Output the number of ways to choose the numbers for each $t$ between $0$ and $2^{k} - 1$ , inclusive, modulo $998244353$ .
输入格式
The first line contains two integers $n$ and $k$ ( $1 \leq n \leq 10^{5}$ , $1 \leq k \leq 17$ ) — the number of arrays and the binary length of all numbers.
The second line contains three integers $x$ , $y$ , $z$ ( $0 \leq x,y,z \leq 10^{9}$ ) — the integers you chose.
Then $n$ lines follow. The $i$ -th of them contains three integers $a_{i}$ , $b_{i}$ and $c_{i}$ ( $0 \leq a_{i} , b_{i} , c_{i} \leq 2^{k} - 1$ ) — the integers forming the $i$ -th array.
The second line contains three integers $x$ , $y$ , $z$ ( $0 \leq x,y,z \leq 10^{9}$ ) — the integers you chose.
Then $n$ lines follow. The $i$ -th of them contains three integers $a_{i}$ , $b_{i}$ and $c_{i}$ ( $0 \leq a_{i} , b_{i} , c_{i} \leq 2^{k} - 1$ ) — the integers forming the $i$ -th array.
输出格式
Print a single line containing $2^{k}$ integers. The $i$ -th of them should be the number of ways to choose exactly one integer from each array so that their XOR is equal to $t = i-1$ modulo $998244353$ .
输入输出样例
输入 #1
1 1 1 2 3 1 0 1
输出 #1
2 4
输入 #2
2 2 1 2 1 0 1 2 1 2 3
输出 #2
4 2 4 6
输入 #3
4 3 1 2 3 1 3 7 0 2 5 1 0 6 3 3 2
输出 #3
198 198 126 126 126 126 198 198
In the first example, the array we formed is $(1, 0, 0, 1, 1, 1)$ , we have two choices to get $0$ as the XOR and four choices to get $1$ .
In the second example, two arrays are $(0, 1, 1, 2)$ and $(1, 2, 2, 3)$ . There are sixteen $(4 \cdot 4)$ choices in total, $4$ of them ( $1 \oplus 1$ and $2 \oplus 2$ , two options for each) give $0$ , $2$ of them ( $0 \oplus 1$ and $2 \oplus 3$ ) give $1$ , $4$ of them ( $0 \oplus 2$ and $1 \oplus 3$ , two options for each) give $2$ , and finally $6$ of them ( $0 \oplus 3$ , $2 \oplus 1$ and four options for $1 \oplus 2$ ) give $3$ .
In the second example, two arrays are $(0, 1, 1, 2)$ and $(1, 2, 2, 3)$ . There are sixteen $(4 \cdot 4)$ choices in total, $4$ of them ( $1 \oplus 1$ and $2 \oplus 2$ , two options for each) give $0$ , $2$ of them ( $0 \oplus 1$ and $2 \oplus 3$ ) give $1$ , $4$ of them ( $0 \oplus 2$ and $1 \oplus 3$ , two options for each) give $2$ , and finally $6$ of them ( $0 \oplus 3$ , $2 \oplus 1$ and four options for $1 \oplus 2$ ) give $3$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted