#abc362e. E - Count Arithmetic Subsequences
E - Count Arithmetic Subsequences
Score : points
问题陈述
给定一个长度为 的序列 。对于每个 ,找出序列 的长度为 的(不一定是连续的)子序列的数量,这些子序列是等差数列。如果它们来自不同的位置,即使它们作为序列是相等的,也视为不同的子序列。
什么是子序列?序列 的子序列是通过从 中删除零个或多个元素,并在不改变剩余元素顺序的情况下排列得到的序列。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given a sequence of length . For each , find the number, modulo , of (not necessarily contiguous) subsequences of of length that are arithmetic sequences. Two subsequences are distinguished if they are taken from different positions, even if they are equal as sequences.
What is a subsequence? A subsequence of a sequence is a sequence obtained by deleting zero or more elements from and arranging the remaining elements without changing the order.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answers for in this order, in a single line, separated by spaces.
Sample Input 1
5
1 2 3 2 3
Sample Output 1
5 10 3 0 0
- There are subsequences of length , all of which are arithmetic sequences.
- There are subsequences of length , all of which are arithmetic sequences.
- There are subsequences of length that are arithmetic sequences: , , and .
- There are no arithmetic subsequences of length or more.
Sample Input 2
4
1 2 3 4
Sample Output 2
4 6 2 1
Sample Input 3
1
100
Sample Output 3
1