問題一覧 > 通常問題

No.2113 Distance Sequence 1.5

レベル : / AI推定難易度 : 1750 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 79
作問者 : bayashiko / テスター : kotatsugame noimi
お気に入りにしたユーザー ProblemId : 8623 / 自分の提出
問題文最終更新日: 2022-10-28 17:08:46
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 366 (順位表) の他の問題:

Problem Statement

Shiiba and Inaba play a game using an integer sequence $A=(a_1,a_2,\ldots,a_{2N})$ with $2N$ elements, each an integer between $1$ and $M$, inclusive, and an empty integer sequence $B$.

Shiiba goes first, and they alternately repeat the following operation until $A$ becomes empty.

  • Choose $1$ element of $A$, remove it from $A$, and append it to the end of $B$.

When $A$ becomes empty, $B$ has $2N$ elements. Writing it as $B=(b_1,b_2,\ldots,b_{2N})$, if there exists an integer $j$ $(1 \leq j \leq 2N-1)$ such that $|b_j-b_{j+1}| \geq K$ holds, the second player Inaba wins; otherwise, the first player Shiiba wins.

There are $M^{2N}$ possible integer sequences $A$ in total. Among them, how many are such that the first player Shiiba wins when both players play optimally?

Find the answer modulo $998244353$.

Input

$N \ M \ K$

  • $1\le N,M,K\le 10^{18}$
  • All input values are integers.

Output

Output the answer modulo $998244353$.

Sample

Sample 1
Input
2 2 1
Output
2

There are $16$ possible sequences $A$ in total, and the first player Shiiba wins for the following $2$ of them.

  • $(1,1,1,1)$
  • $(2,2,2,2)$

Sample 2
Input
3 3 3
Output
729

There are $729$ possible sequences $A$ in total, and Shiiba wins for all of them.

Sample 3
Input
178096 418269 13333
Output
111203503

Note that you should output the answer modulo $998244353$.

Sample 4
Input
1000 1000000000000 998244853
Output
662474981

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