No.3480 Prefix Advantage
レベル :
/ AI推定難易度 : 2575
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 12
作問者 : 👑
potato167
タグ : / 解いたユーザー数 12
作問者 : 👑
問題文最終更新日: 2026-03-20 04:15:50
English (AI translation)
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 494 オムニバス
(順位表)
の他の問題:
Problem Statement
You are given positive integers $N, P, Q$.
Here, $P, Q$ are coprime.
For each $n = 1, 2, \dots, N$, answer the following question.
Find the number, modulo $998244353$, of pairs $(A, B)$ of non-negative integer sequences $A = (A_{1}, A_{2}, \dots, A_{n}), B = (B_{1}, B_{2}, \dots, B_{n})$ of length $n$ that satisfy all of the following conditions.
- $\sum A = P$
- $\sum B = Q$
- For every integer $m$ between $1$ and $n$, inclusive, the following holds.
- $\displaystyle Q\sum_{i = 1}^{m} A_{i} \geq P\sum_{i = 1}^{m} B_{i}$
Constraints
- $1\leq N\leq 5\times 10^{5}$
- $1\leq P\leq 5\times 10^{5}$
- $1\leq Q\leq 5\times 10^{5}$
- $\mathrm{gcd}(P, Q) = 1$
- All input values are integers.
Input
$N$ $P$ $Q$
Output
Print $N$ lines.
On the $i$-th line, print the answer for $n = i$.
Sample
Sample 1
Input
3 1 1
Output
1 3 6
Sample 2
Input
5 2 3
Output
1 7 27 77 182
Sample 3
Input
16 79 24
Output
1 1001 352001 65111501 602454930 711287574 473879682 9649799 360574128 569945347 993487430 346927517 744590286 964120490 323267590 17560896
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。