CF1129D Isolation
Description
Find the number of ways to divide an array $ a $ of $ n $ integers into any number of disjoint non-empty segments so that, in each segment, there exist at most $ k $ distinct integers that appear exactly once.
Since the answer can be large, find it modulo $ 998\,244\,353 $ .
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first sample, the three possible divisions are as follows.
- $ [[1], [1], [2]] $
- $ [[1, 1], [2]] $
- $ [[1, 1, 2]] $
Division $ [[1], [1, 2]] $ is not possible because two distinct integers appear exactly once in the second segment $ [1, 2] $ .