問題一覧 > 通常問題

No.1191 I Want to Love Counting (Sequence Edition)

レベル : / AI推定難易度 : 1650 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 115
作問者 : sanada_atcoder / テスター : Rho
お気に入りにしたユーザー ProblemId : 4390 / 自分の提出
問題文最終更新日: 2020-08-17 22:30:27
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
技術室奥プログラミングコンテスト#5 Day1 (順位表) の他の問題:

Problem Statement

Find the number of possible sequences $S$ of length $N$ satisfying the following conditions, modulo $998244353$.

  • Each element of the sequence is an integer between $1$ and $M$, inclusive.
  • For any $i,j$ satisfying $1 \le i < j \le N$, $A \le |S_i-S_j| \le B$ holds.
  • Input

    $N\ M\ A\ B$
    

    All numbers given in the input are integers.
    $2 \le N \le 10^5$
    $2 \le M \le 3×10^5$
    $1 \le A \le B \le M-1$

    Output

    Output the remainder when divided by $998244353$. Print a newline at the end.

    Sample

    Sample 1
    Input
    2 2 1 1
    Output
    2

    There are 2 such sequences: {$1,2$} and {$2,1$}.

    Sample 2
    Input
    3 5 1 1
    Output
    0

    No sequence satisfies the conditions.

    Sample 3
    Input
    4 19 3 15
    Output
    11088

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