8677: Fly

内存限制:128 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:5 通过:1

题目描述


Groudon wanna fly. Kyogre will tell Groudon how to fly if and only if Groudon solves the following problem.

There are nnn integers a1,a2,…,ana_1,a_2,\ldots,a_na1,a2,,an, one integer mmm and kkk integer pairs (b1,c1),(b2,c2),…,(bk,ck)(b_1,c_1), (b_2,c_2), \ldots, (b_k,c_k)(b1,c1),(b2,c2),,(bk,ck). You need to find the number of non-negative nnn-tuples (x1,x2,…,xn)(x_1,x_2,\ldots,x_n)(x1,x2,,xn) which satisfies:


{∑i=1naixi≤mxbi&⁡2ci=0 for i=1,2,…,k\begin{cases} \displaystyle \sum_{i=1}^na_ix_i \le m \\ \displaystyle x_{b_i} \operatorname{\&} 2^{c_i} = 0 \text{ for } i =1,2,\ldots,k \end{cases}i=1naiximxbi&2ci=0 for i=1,2,,k


Here, &⁡\operatorname{\&}& denotes the bitwise operation AND.

Two non-negative nnn-tuples (x1,x2,…,xn)(x_1,x_2,\ldots,x_n)(x1,x2,,xn) and (x1′,x2′,…,xn′)(x'_1,x'_2,\ldots,x'_n)(x1,x2,,xn) are considered different if and only if there exists one integer i∈[1,n]i \in [1,n]i[1,n] which satisfies xi≠xi′x_i \ne x'_ixi=xi.

Since the answer is too large, Kyogre only wants to know it modulo 998244353998\,244\,353998244353.

You, as a programmer of Hoenn, please help Groudon!

输入格式


The first line contains three integers n,m,kn,m,kn,m,k (1≤n≤4×104,0≤m≤1018,1≤k≤5×1031 \le n \le 4 \times 10^4,0 \le m \le 10^{18},1 \le k \le 5 \times 10^31n4×104,0m1018,1k5×103).
The second line contains nnn integers a1,a2,…,ana_1,a_2,\ldots,a_na1,a2,,an (1≤ai≤4×104,∑i=1nai≤4×1041 \le a_i\le 4 \times10^{4},\sum_{i=1}^n a_i \le 4 \times 10^41ai4×104,i=1nai4×104).
For the iii-th line in the following kkk lines, there are two integers bi,cib_i,c_ibi,ci (1≤bi≤n,0≤ci<601 \le b_i \le n,0 \le c_i < 601bin,0ci<60).
All numbers in the input denote the parameter of Kyogre's problem.


输出格式

链接:https://ac.nowcoder.com/acm/contest/33186/H
来源:牛客网
Print a single integer, denoting the answer to Kyogre's problem, modulo 998244353998\,244\,353998244353.

输入样例 复制

3 5 1
2 3 3
1 0

输出样例 复制

4

数据范围与提示


In the first example, there are 444 non-negative 333-tuples satisfy the condition in Kyogre's problem: (0,0,0)(0, 0, 0)(0,0,0)(2,0,0)(2, 0, 0)(2,0,0)(0,1,0)(0, 1, 0)(0,1,0)(0,0,1)(0, 0, 1)(0,0,1).

分类标签