問題一覧 > 通常問題

No.1066 #Various Colors / Red and Blue and more various colors (Easy)

レベル : / AI推定難易度 : 900 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 128 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 225
作問者 : leafirby / テスター : harady_a_human
お気に入りにしたユーザー ProblemId : 4157 / 自分の提出
問題文最終更新日: 2020-06-03 02:37:51
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 250 (順位表) の他の問題:

Problem Statement

There are $N$ boxes here. The $i(1\leq i\leq N)$-th box contains $A_i$ balls.
More specifically, box $i$ contains exactly $1$ ball of each color from color $1$ to color $A_i$.
Answer $Q$ queries. The $i(1\leq i\leq Q)$-th query is as follows.

  • When taking out 1 ball from each box, print the number of ways in which exactly $B_i$ of the balls taken are of color $1$, $mod998244353$.

  • Input

    $N\ Q$
    $A_1\ A_2\ ...\ A_N$
    $B_1\ B_2\ ...\ B_Q$
    

    $1\le N\le 6000$
    $1\le Q\le N+1$
    $1\le A_i\le 2\times 10^5$
    $0\le B_i\le N$
    All inputs are integers.

    Output

    Answer the $Q$ queries, and print a newline at the end.

    Sample

    Sample 1
    Input
    3 4
    3 4 5
    0 1 2 3
    Output
    24
    26
    9
    1

    There are $60$ ways in total to take the balls. Among them, there are $24$ ways in which not even $1$ ball of color $1$ is included.

    Sample 2
    Input
    4 3
    1 3 3 3
    3 1 4
    Output
    6
    8
    1

    Sample 3
    Input
    3 2
    5 7 5
    1 3
    Output
    64
    1

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