NECプログラミングコンテスト2022 (AtCoder Beginner Contest 267)
翻译中…
Problem Statement
翻译中…
You are given an integer sequence $A = (A_1, \dots, A_N)$ of length $N$.
翻译中…
Find the number, modulo $998244353$, of permutations $P = (P_1, \dots, P_N)$ of $(1, 2, \dots, N)$ such that:
翻译中…
- there exist exactly
$K$integers$i$between$1$and$(N-1)$(inclusive) such that$A_{P_i} \lt A_{P_{i + 1}}$.
翻译中…
Constraints
翻译中…
$2 \leq N \leq 5000$$0 \leq K \leq N - 1$$1 \leq A_i \leq N \, (1 \leq i \leq N)$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N K
A_1 \ldots A_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
4 2
1 1 2 2
Output #1
4
Four permutations satisfy the condition: $P = (1, 3, 2, 4), (1, 4, 2, 3), (2, 3, 1, 4), (2, 4, 1, 3)$.
Input #2
10 3
3 1 4 1 5 9 2 6 5 3
Output #2
697112
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。