問題一覧 > 通常問題

No.2511 Mountain Sequence

レベル : / AI推定難易度 : 1350 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 82
作問者 : GlinTFraulein / テスター : PCTprobability Mizar 👑 amentorimaru 👑 獅子座じゃない人
お気に入りにしたユーザー ProblemId : 9868 / 自分の提出
問題文最終更新日: 2023-10-20 22:21:56
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 409 (順位表) の他の問題:

Problem Statement

You are given positive integers $N,M$. Here, a sequence of positive integers $A=(A_1,A_2,\dots,A_N)$ of length $N$ is called a "mountain sequence" if it satisfies the following condition.

  • There exists an integer $i$ between $1$ and $N$, inclusive, such that all of the following hold.
    • $A_1 < A_2 < … < A_i$
    • $A_i > A_{i+1} > … > A_N$
    • $A_i \le M$

Find the number of "mountain sequences", modulo $998244353$.

Constraints

  • $1 \le N \le 2 \times 10^5$
  • $1 \le M \le 2 \times 10^5$
  • All inputs are integers.

Input

$N\ M$

Output

Print the number of "mountain sequences", modulo $998244353$.

Sample

Sample 1
Input
4 3
Output
4

The "mountain sequences" are the following $4$: $(1, 2, 3, 1)$, $(1, 2, 3, 2)$, $(1, 3, 2, 1)$, $(2, 3, 2, 1)$.

Sample 2
Input
5 1
Output
0

There may be no "mountain sequence" satisfying the condition.

Sample 3
Input
12345 123456
Output
412894584

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