#abc336g. G - 16 Integers

G - 16 Integers

Score: 650650 points

问题描述

给定16个非负整数 Xi,j,k,lX_{i, j, k, l} (i,j,k,l{0,1})(i, j, k, l \in \lbrace 0, 1 \rbrace),按照 (i,j,k,l)(i, j, k, l) 的升序排列。

令 $N = \displaystyle \sum_{i=0}^1 \sum_{j=0}^1 \sum_{k=0}^1 \sum_{l=0}^1 X_{i,j,k,l}$。

求满足以下条件的长度为 N+3N+3、仅包含0和1的序列 (A1,A2,...,AN+3)(A_1, A_2, ..., A_{N+3}) 的数量,模 998244353998244353 后的结果。

  • 对于所有四元组 (i,j,k,l)(i, j, k, l) (i,j,k,l{0,1})(i, j, k, l \in \lbrace 0, 1 \rbrace),存在恰好 Xi,j,k,lX_{i,j,k,l} 个整数 ss,满足 1sN1 \leq s \leq N,且:
    • As=iA_s = iAs+1=jA_{s + 1} = jAs+2=kA_{s + 2} = k,以及 As+3=lA_{s + 3} = l

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

Problem Statement

You are given 1616 non-negative integers Xi,j,k,lX_{i, j, k, l} (i,j,k,l{0,1})(i, j, k, l \in \lbrace 0, 1 \rbrace) in ascending order of (i,j,k,l)(i, j, k, l).
Let $N = \displaystyle \sum_{i=0}^1 \sum_{j=0}^1 \sum_{k=0}^1 \sum_{l=0}^1 X_{i,j,k,l}$.
Find the number, modulo 998244353998244353, of sequences (A1,A2,...,AN+3)(A_1, A_2, ..., A_{N+3}) of length N+3N + 3 consisting of 00s and 11s that satisfy the following condition.

  • For every quadruple of integers (i,j,k,l)(i, j, k, l) (i,j,k,l{0,1})(i, j, k, l \in \lbrace 0, 1 \rbrace), there are exactly Xi,j,k,lX_{i,j,k,l} integers ss between 11 and NN, inclusive, that satisfy:
    • As=iA_s = i, As+1=jA_{s + 1} = j, As+2=kA_{s + 2} = k, and As+3=lA_{s + 3} = l.

Constraints

  • Xi,j,k,lX_{i, j, k, l} are all non-negative integers.
  • $1 \leq \displaystyle \sum_{i=0}^1 \sum_{j=0}^1 \sum_{k=0}^1 \sum_{l=0}^1 X_{i,j,k,l} \leq 10^6$

Input

The input is given from Standard Input in the following format:

X0,0,0,0X_{0,0,0,0} X0,0,0,1X_{0,0,0,1} X0,0,1,0X_{0,0,1,0} X0,0,1,1X_{0,0,1,1} X0,1,0,0X_{0,1,0,0} X0,1,0,1X_{0,1,0,1} X0,1,1,0X_{0,1,1,0} X0,1,1,1X_{0,1,1,1} X1,0,0,0X_{1,0,0,0} X1,0,0,1X_{1,0,0,1} X1,0,1,0X_{1,0,1,0} X1,0,1,1X_{1,0,1,1} X1,1,0,0X_{1,1,0,0} X1,1,0,1X_{1,1,0,1} X1,1,1,0X_{1,1,1,0} X1,1,1,1X_{1,1,1,1}

Output

Print the number, modulo 998244353998244353, of sequences that satisfy the condition in the problem statement.

Sample Input 1

0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0

Sample Output 1

1

This input corresponds to the case where X1,0,1,0X_{1, 0, 1, 0} and X1,1,0,1X_{1, 1, 0, 1} are 11 and all others are 00.
In this case, only one sequence satisfies the condition, which is (1,1,0,1,0)(1, 1, 0, 1, 0).

Sample Input 2

1 1 2 0 1 2 1 1 1 1 1 2 1 0 1 0

Sample Output 2

16

Sample Input 3

21 3 3 0 3 0 0 0 4 0 0 0 0 0 0 0

Sample Output 3

2024

Sample Input 4

62 67 59 58 58 69 57 66 67 50 68 65 59 64 67 61

Sample Output 4

741536606

update @ 2024/3/10 01:26:33