#abc260e. E - At Least One
E - At Least One
Score : points
问题描述
给定一个整数 和 对整数 。 对于所有 ,满足条件 。
若一个序列 满足以下条件,则称其为 良序序列:
- 是序列 的连续子序列。
- 对于所有 , 至少包含 或 中的一个元素。
令 表示长度为 的可能良序序列的数量。
请列举出 的值。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given an integer and pairs of integers .
For all , it holds that .
A sequence is said to be a good sequence if the following conditions are satisfied:
- is a contiguous subsequence of the sequence .
- For all , contains at least one of and .
Let be the number of possible good sequences of length .
Enumerate .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answers in the following format:
Sample Input 1
3 5
1 3
1 4
2 5
Sample Output 1
0 1 3 2 1
Here is the list of all possible good sequences.
Sample Input 2
1 2
1 2
Sample Output 2
2 1
Sample Input 3
5 9
1 5
1 7
5 6
5 8
2 6
Sample Output 3
0 0 1 2 4 4 3 2 1
update @ 2024/3/10 11:01:55