#abc362e. E - Count Arithmetic Subsequences

E - Count Arithmetic Subsequences

Score : 475475 points

问题陈述

给定一个长度为 NN 的序列 A=(A1,A2,,AN)A = (A_1, A_2, \dots, A_N)。对于每个 k=1,2,,Nk = 1, 2, \dots, N,找出序列 AA 的长度为 kk 的(不一定是连续的)子序列的数量,这些子序列是等差数列。如果它们来自不同的位置,即使它们作为序列是相等的,也视为不同的子序列。

什么是子序列?序列 AA 的子序列是通过从 AA 中删除零个或多个元素,并在不改变剩余元素顺序的情况下排列得到的序列。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

You are given a sequence A=(A1,A2,,AN)A = (A_1, A_2, \dots, A_N) of length NN. For each k=1,2,,Nk = 1, 2, \dots, N, find the number, modulo 998244353998244353, of (not necessarily contiguous) subsequences of AA of length kk 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 AA is a sequence obtained by deleting zero or more elements from AA and arranging the remaining elements without changing the order.

Constraints

  • 1N801 \leq N \leq 80
  • 1Ai1091 \leq A_i \leq 10^9
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \dots ANA_N

Output

Print the answers for k=1,2,,Nk = 1, 2, \dots, N 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 55 subsequences of length 11, all of which are arithmetic sequences.
  • There are 1010 subsequences of length 22, all of which are arithmetic sequences.
  • There are 33 subsequences of length 33 that are arithmetic sequences: (A1,A2,A3)(A_1, A_2, A_3), (A1,A2,A5)(A_1, A_2, A_5), and (A1,A4,A5)(A_1, A_4, A_5).
  • There are no arithmetic subsequences of length 44 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
}