#P10104. [GDKOI2023 提高组] 异或图

[GDKOI2023 提高组] 异或图

Problem Description

Given an undirected graph with nn vertices and mm edges, an array a1,a2,,ana_1, a_2, \cdots , a_n of length nn, and an integer CC, you need to count how many arrays bb of length nn satisfy:

  1. 0biai,1in0 \le b_i \le a_i, \forall 1 \le i \le n
  2. For every edge (u,v)(u, v), bubvb_u \ne b_v
  3. b1b2bn=Cb_1 \oplus b_2 \oplus \cdots \oplus b_n = C, where \oplus denotes bitwise XOR.

Output the answer modulo 998244353998244353

Input Format

The first line contains three integers n,m,cn, m, c

The second line contains nn integers a1,a2,,ana_1, a_2, \cdots , a_n

The next mm lines each contain two positive integers u,vu, v, representing an undirected edge。

Output Format

Output one integer, the answer。

3 1 2
1 2 3
1 2

4
4 6 2
7 11 14 0
1 2
1 3
2 3
2 4
4 1
4 3
44

Hint

There are four feasible arrays bb: (0,1,3),(0,2,0),(1,0,3),(1,2,1)(0, 1, 3), (0, 2, 0), (1, 0, 3), (1, 2, 1)

For all testdata, 1n151 \le n \le 15, 0mn(n1)20 \le m \le \frac{n(n-1)}{2}, 0ai,C10180 \le a_i, C \le 10^{18}

  • Subtask 1 (20pts): n5n \le 5, 0ai,C150 \le a_i, C \le 15
  • Subtask 2 (50pts): n13n \le 13
  • Subtask 3 (10pts): m=0m = 0
  • Subtask 4 (20pts): No special constraints。

Translated by ChatGPT 5