問題一覧 > 通常問題

No.2068 Restricted Permutation

レベル : / AI推定難易度 : 1700 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 33
作問者 : 👑 qand / テスター : SSRS ygussany とりゐ
お気に入りにしたユーザー ProblemId : 8354 / 自分の提出
問題文最終更新日: 2022-09-01 01:32: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 359 (順位表) の他の問題:

Problem Statement

For a permutation $P$ of length $N$, define $f(P)$ as the number of permutations of length $N$ that come before $P$ in lexicographical order.
There are $(N-1)!$ permutations $P$ of length $N$ satisfying $P_K=X$. Compute $f(P)$ for each of them and find the sum of these values.
Since the sum can be very large, output it modulo $998244353$.

▶What is a permutation of length $N$?

It refers to a rearrangement of $(1,2,\ldots,N)$.

▶What does it mean to come before in lexicographical order?

For permutations $P,Q$ of length $N$, $P$ comes before $Q$ if there exists an $i$ such that $P_i\neq Q_i$ and, letting $j$ be the smallest such $i$, we have $P_j < Q_j$.

Input

$N\ K\ X$

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

    Compute $f(P)$ for all permutations $P$ of length $N$ satisfying $P_K=X$, and output the sum of these values modulo $998244353$.

    Sample

    Sample 1
    Input
    3 2 1
    Output
    6

    The permutations $P$ satisfying the condition are $P=(2,1,3),(3,1,2)$, for which $f(P)=2,4$ respectively. Therefore, output their sum, $6$.

    Sample 2
    Input
    4 4 4
    Output
    42

    Sample 3
    Input
    100 1 3
    Output
    967152772

    Output the answer modulo $998244353$.

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