#P10916. 椰子
椰子
Background
As everyone knows, a coconut is a coconut, but this seems to have nothing to do with the problem.
Problem Description
You are given a sequence of length . We guarantee that every number from to appears in exactly once. For each , after changing the value in the sequence to , find how many different subarray values the sequence has.
More precisely, let be the sequence after changing the number with value to . Define the set $S_x=\{\gcd\limits_{i=l}^r(A^x_i)|1\le l\le r\le n\}$. Compute for all .
Input Format
The first line contains a positive integer , the length of the permutation.
The next line contains positive integers, the sequence .
Output Format
Output one line with integers in total. The -th integer denotes the number of different subarray values after changing the number with value to .
3
3 1 2
3 2 2
6
3 6 4 1 5 2
6 6 5 5 5 5
Hint
Sample Explanation 1
After changing to , there are different subarray values: . They can correspond to subarrays , , and , respectively.
After changing to , there are different subarray values: . They can correspond to subarrays and , respectively.
After changing to , there are different subarray values: . They can correspond to subarrays and , respectively.
Constraints and Notes
This problem uses bundled testdata.
| Score | Constraints | Special Property | |
|---|---|---|---|
| No special restrictions. | |||
| No special restrictions. | . | ||
| No special restrictions. |
: For all , we have .
For all testdata, . We guarantee that every number from to appears in exactly once.
Translated by ChatGPT 5