No.2512 Mountain Sequences
レベル :
/ AI推定難易度 : 2450
/ 実行時間制限 : 1ケース 3.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 25
作問者 :
GlinTFraulein
/ テスター :
PCTprobability
kemuniku
Mizar
👑
seekworser
👑
amentorimaru
👑
獅子座じゃない人
タグ : / 解いたユーザー数 25
作問者 :
GlinTFraulein
/ テスター :
PCTprobability
kemuniku
amentorimaru
👑
問題文最終更新日: 2023-10-20 21:42:52
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 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$ that satisfies the following condition is called a "mountain sequence".
- 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$.
You are given $T$ test cases; find the answer for each of them.
Constraints
- $1 \le T \le 2 \times 10^5$
- $1 \le N \le 2 \times 10^5$
- $1 \le M \le 2 \times 10^5$
- All input values are integers.
Input
$T$
$\mathrm{case}_1$
$\mathrm{case}_2$
$\vdots$
$\mathrm{case}_T$
Here, $\mathrm{case}_i$ denotes the $i$-th test case. Each test case is given in the following format.
$N$ $M$
Output
Print $T$ lines. On the $i(1 \le i \le T)$-th line, print the answer to $\mathrm{case}_i$.
Sample
Sample 1
Input
3 4 3 5 1 12345 123456
Output
4 0 412894584
For example, in case 1, the "mountain sequences" are $(1, 2, 3, 1)$, $(1, 2, 3, 2)$, $(1, 3, 2, 1)$, and $(2, 3, 2, 1)$, for a total of $4$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。