AT_abc458_e.Count 123

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Find the number, modulo 998244353998244353, of sequences A=(a1,⋯ ,aX1+X2+X3)A = (a_1, \cdots, a_{X_1 + X_2 + X_3}) of length X1+X2+X3X_1+X_2+X_3 that satisfy all of the following conditions.

  • AA contains exactly X1X_1 copies of 11, exactly X2X_2 copies of 22, and exactly X3X_3 copies of 33.
  • The absolute difference between adjacent elements is at most 11. That is, for every integer ii satisfying 1≤i≤X1+X2+X3−11 \leq i \leq X_1+X_2+X_3-1, we have ∣ai+1−ai∣≤1|a_{i+1} - a_i| \leq 1.

求满足以下所有条件的序列 A=(a1,⋯ ,aX1+X2+X3)A = (a_1, \cdots, a_{X_1 + X_2 + X_3})(长度为 X1+X2+X3X_1+X_2+X_3)的个数,答案对 998244353998244353 取模。

  • AA 中恰好包含 X1X_1 个 11、恰好包含 X2X_2 个 22、恰好包含 X3X_3 个 33;
  • 相邻元素的绝对差值至多为 11。即,对每个满足 1≤i≤X1+X2+X3−11 \leq i \leq X_1+X_2+X_3-1 的整数 ii,均有 ∣ai+1−ai∣≤1|a_{i+1} - a_i| \leq 1。

输入格式

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

X1X_1 X2X_2 X3X_3

输入从标准输入中按以下格式给出:

X1X_1 X2X_2 X3X_3

输出格式

Output the answer.

输出答案。

输入输出样例

  • 输入#1

    2 2 1

    输出#1

    9
  • 输入#2

    5 3 4

    输出#2

    204
  • 输入#3

    998244 998353 998107

    输出#3

    701926019

说明/提示

Sample 1 Explanation:
The sequences satisfying the conditions are the following nine:

  • (1,1,2,2,3)(1, 1, 2, 2, 3)
  • (1,1,2,3,2)(1, 1, 2, 3, 2)
  • (1,2,1,2,3)(1, 2, 1, 2, 3)
  • (1,2,3,2,1)(1, 2, 3, 2, 1)
  • (2,1,1,2,3)(2, 1, 1, 2, 3)
  • (2,3,2,1,1)(2, 3, 2, 1, 1)
  • (3,2,1,1,2)(3, 2, 1, 1, 2)
  • (3,2,1,2,1)(3, 2, 1, 2, 1)
  • (3,2,2,1,1)(3, 2, 2, 1, 1)

Constraints

  • 1≤X1,X2,X3≤1061 \leq X_1, X_2, X_3 \leq 10^6
  • All input values are integers.

样例 1 解释:
满足条件的序列共有以下九个:

  • (1,1,2,2,3)(1, 1, 2, 2, 3)
  • (1,1,2,3,2)(1, 1, 2, 3, 2)
  • (1,2,1,2,3)(1, 2, 1, 2, 3)
  • (1,2,3,2,1)(1, 2, 3, 2, 1)
  • (2,1,1,2,3)(2, 1, 1, 2, 3)
  • (2,3,2,1,1)(2, 3, 2, 1, 1)
  • (3,2,1,1,2)(3, 2, 1, 1, 2)
  • (3,2,1,2,1)(3, 2, 1, 2, 1)
  • (3,2,2,1,1)(3, 2, 2, 1, 1)

限制条件

  • 1≤X1,X2,X3≤1061 \leq X_1, X_2, X_3 \leq 10^6
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页