问题 F: Educational Problem II

内存限制:512 MB 时间限制:4 S 标准输入输出
题目类型:传统 评测方式:Special Judge 上传者:
提交:1 通过:1

题目描述

链接:https://ac.nowcoder.com/acm/contest/57362/F
来源:牛客网
You are given n,m,l,rn,m,l,rn,m,l,r and a matrix B=(bi,j)n×mB=(b_{i,j})_{n\times m}B=(bi,j)n×m.

Count the number of integer sequence a1,a2,…,ana_1,a_2,\ldots,a_na1,a2,,an satisfying the following conditions, modulo 998244353998\,244\,353998244353:

  • ∀i∈Z∩[1,n]\forall i \in \mathbb{Z} \cap [1,n]iZ[1,n], l≤ai≤rl \le a_i \le rlair.
  • ∀i∈Z∩[1,n]\forall i \in \mathbb{Z} \cap [1,n]iZ[1,n], ∃S⊆Z∩[1,m]\exists S \subseteq \mathbb{Z} \cap [1,m]SZ[1,m], ai=⨁j∈Sbi,ja_i = \bigoplus_{j \in S} b_{i,j}ai=jSbi,j. That is, aia_iai is equal to the bitwise XOR sum of some subsequence of (bi,1,bi,2,…,bi,m)(b_{i,1},b_{i,2},\ldots,b_{i,m})(bi,1,bi,2,,bi,m), and ai=0a_i = 0ai=0 if the subsequence is empty.
  •  The number of i∈Z∩[2,n]i \in \mathbb{Z} \cap [2,n]iZ[2,n] that ai−1≠aia_{i-1} \neq a_{i}ai1=ai is minimized among all the sequences satisfying the above two conditions.

输入格式

The first line contains four integers n,m,l,rn,m,l,rn,m,l,r (2≤n≤1052 \le n \le 10^52n105, 2≤nm2≤4×1072 \le nm^2 \le 4 \times 10^72nm24×107, 0≤l≤r<2m0 \le l \le r < 2^m0lr<2m).
The iii-th of the following nnn lines contains mmm integers bi,1,bi,2,…,bi,mb_{i,1},b_{i,2},\ldots,b_{i,m}bi,1,bi,2,,bi,m (0≤bi,j<2m0 \le b_{i,j} < 2^m0bi,j<2m).
Please note that l,r,bi,jl,r,b_{i,j}l,r,bi,j are given in binary notation length of mmm.

输出格式




Output an integer representing the answer.
样例输入2:
3 2 11 11
01 00
01 10
00 10
样例输出2:
0
样例输入3:
5 3 100 110
111 011 111
100 100 001
111 111 010
001 101 010
110 010 010
样例输出3:
8

输入样例 复制

3 2 01 10
01 00
01 10
00 10

输出样例 复制

2