时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
Let P = 998244353, for two vectors
)
,
)
of length 3, Bobo defines their (multiplicative) product as
%20%5Ctimes%20(b_0%2C%20b_1%2C%20b_2)%20%5C%5C%20%3D%20(%0A(a_0%20b_0%20%2B%20a_1%20b_2%20%2B%20a_2%20b_1)%20%5Cbmod%20P%2C%20%5C%5C%0A(a_1%20b_0%20%2B%20a_2%20b_2%20%2B%20a_0%20b_1)%20%5Cbmod%20P%2C%20%5C%5C%0A(a_2%20b_0%20%2B%20a_0%20b_2%20%2B%20a_1%20b_1)%20%5Cbmod%20P%0A).)
Given n 3-vectors

and

integers

, he would like to compute q products, which are

The vectors and integers are generated given parameters

by the following codes:
z = z0
for i in 1..n
for j in 0..2
z = (z * a + b) mod 2^32
v[i][j] = z mod P
for k in 1..q
for i in 1..n
e[k][i] = 0
for j in 0..(m - 1)
z = (z * a + b) mod 2^32
e[k][i] += z * 2^{32 * j}
输入描述:
The input file contains 6 integers n, m, q,
, a, b.
* 
* 
* 
* 
输出描述:
Print q 3-vectors which denote the result.
示例1
输出
复制
213483525 14344689 213483525
664318592 664318592 318688993
备注:
For the sample,
*
,
*
,
*
,
,
*
,
.