問題一覧 > 通常問題

No.2959 Dolls' Tea Party

レベル : / AI推定難易度 : 2450 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 22
作問者 : 👑 binap / テスター : ecottea 👑 hamamu
お気に入りにしたユーザー ProblemId : 11400 / 自分の提出
問題文最終更新日: 2025-01-07 22:40:15
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 452 (順位表) の他の問題:

Problem Statement

binap loves playing with dolls. He always seats his dolls around a round table to recreate a tea party, and he suddenly began to wonder how many ways there are to seat them.

binap has $N$ kinds of dolls, and there are $A_i$ dolls of the $i$-th kind. The round table can seat $K$ dolls at equal intervals. No seat may be left empty.

Please find the number of ways to seat the dolls. Since the answer can be very large, output the remainder when it is divided by the prime $998244353$.

Two seatings are considered different if and only if no rotation of the round table in the plane can make the kinds of all the seated dolls match.

Constraints

  • $1 \leq N \leq 3\times10^5$

  • $2 \leq K \leq 1300$

  • $1 \leq A_i \leq 998244352(1\leq i \leq N)$

  • $K \leq \sum_{i=1}^N A_i$

  • All inputs are integers.

Input

$N$ $K$
$A_1$ $A_2$ $\cdots$ $A_N$

Output

Output the total number of seatings modulo $998244353$.

Sample

Sample 1
Input
3 3
2 1 1
Output
4

There are the $4$ ways shown in the figures below. Note in particular that the $3$rd and $4$th figures are distinguished from each other.

Sample 2
Input
3 6
3 4 1
Output
32

Sample 3
Input
5 4
4 4 3 2 1
Output
128

Sample 4
Input
14 14
1 1 1 1 1 1 1 1 1 1 1 1 1 1
Output
237554682

Output the total number of seatings modulo $998244353$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。