#P4070. [SDOI2016] 生成魔咒
[SDOI2016] 生成魔咒
Description
A spell string consists of many spell characters, and a spell character can be represented by a number. For example, we can piece together spell characters to form a spell string .
A non-empty substring of a spell string is called a generating spell of .
For example, when , its generating spells are , five in total. When , its generating spells are , three in total. Initially, is an empty string.
There are operations in total. In each operation, one spell character is appended to the end of . After each operation, you need to determine how many distinct generating spells the current spell string has.
Input Format
The first line contains an integer .
The second line contains numbers. The -th number denotes the spell character appended in the -th operation.
Output Format
Output lines, one number per line.
The number on the -th line denotes the number of distinct generating spells after the -th operation.
7
1 2 3 3 3 1 2
1
3
6
9
12
17
22
Hint
Constraints
For 10% of the testdata, it is guaranteed that .
For 30% of the testdata, it is guaranteed that .
For 60% of the testdata, it is guaranteed that .
For 100% of the testdata, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号