#abc267h. Ex - Odd Sum

Ex - Odd Sum

Score : 600600 points

问题描述

给定一个长度为 NN 的序列 A=(A1,A2,,AN)A=(A_1,A_2,\dots,A_N)

要求计算从 AA 中选择奇数个元素,使得所选元素之和等于 MM 的方法数量,结果对 998244353998244353 取模。

如果存在一个整数 i(1iN)i (1 \le i \le N),使得在一个选择中选取了 AiA_i,而在另一个选择中未选取,则认为这两种选择是不同的。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given a sequence A=(A1,A2,,AN)A=(A_1,A_2,\dots,A_N) of length NN.

Find the number, modulo 998244353998244353, of ways to choose an odd number of elements from AA so that the sum of the chosen elements equals MM.

Two choices are said to be different if there exists an integer i(1iN)i (1 \le i \le N) such that one chooses AiA_i but the other does not.

Constraints

  • 1N1051 \le N \le 10^5
  • 1M1061 \le M \le 10^6
  • 1Ai101 \le A_i \le 10
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

A1A_1 A2A_2 \dots ANA_N

Output

Print the answer.

Sample Input 1

5 6
1 2 3 3 6

Sample Output 1

3

The following 33 choices satisfy the condition:

  • Choosing A1A_1, A2A_2, and A3A_3.
  • Choosing A1A_1, A2A_2, and A4A_4.
  • Choosing A5A_5.

Choosing A3A_3 and A4A_4 does not satisfy the condition because, although the sum is 66, the number of chosen elements is not odd.

Sample Input 2

10 23
1 2 3 4 5 6 7 8 9 10

Sample Output 2

18

update @ 2024/3/10 11:17:29

}