AT_ndpc2026_i.Update Positions
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
For a sequence B=(B1,B2,…,BN) of length N, define prefix max update positions and suffix max update positions as follows:
- An index i is called a prefix max update position if for all 1≤j<i, we have Bj<Bi.
- An index i is called a suffix max update position if for all i<j≤N, we have Bj<Bi.
You are given a sequence A=(A1,A2,…,AN) of length N, and integers L and R.
Consider all sequences obtained by rearranging the elements of A. Among them, count how many sequences have exactly L prefix max update positions and exactly R suffix max update positions. Output the answer modulo 998244353.
Two sequences are considered the same if they are identical as sequences.
对于一个长度为 N 的序列 B=(B1,B2,…,BN),定义其前缀最大值更新位置与后缀最大值更新位置如下:
- 若对所有满足 1≤j<i 的 j 均有 Bj<Bi,则称下标 i 为一个前缀最大值更新位置;
- 若对所有满足 i<j≤N 的 j 均有 Bj<Bi,则称下标 i 为一个后缀最大值更新位置。
给定一个长度为 N 的序列 A=(A1,A2,…,AN),以及两个整数 L 和 R。
考虑所有由 A 的元素重排得到的序列。在这些序列中,统计恰好具有 L 个前缀最大值更新位置且恰好具有 R 个后缀最大值更新位置的序列个数。答案对 998244353 取模。
若两个序列作为序列完全相同,则视为同一个序列。
输入格式
The input is given from standard input in the following format:
N L R
A1 A2 … AN
输入从标准输入中按以下格式给出:
N L R
A1 A2 … AN
输出格式
Print the number of sequences satisfying the conditions, modulo 998244353.
输出满足条件的序列数量,对 998244353 取模。
输入输出样例
输入#1
4 2 1 1 2 3 4
输出#1
2
输入#2
10 3 2 6 10 4 1 5 9 8 6 5 1
输出#2
50424
说明/提示
Sample 1 Explanation:
There are 2 such sequences:
- (3,2,1,4)
- (3,1,2,4)
Constraints
- 1≤N≤400
- 1≤L≤N
- 1≤R≤N
- 1≤Ai≤N
- All input values are integers
样例 1 解释:
满足条件的序列共有 2 个:
- (3,2,1,4)
- (3,1,2,4)
约束条件
- 1≤N≤400
- 1≤L≤N
- 1≤R≤N
- 1≤Ai≤N
- 所有输入值均为整数
输入解题思路,AI测评打分。不知道怎么写?