#P11753. [COCI 2024/2025 #5] 塔楼 / Tornjevi
[COCI 2024/2025 #5] 塔楼 / Tornjevi
Description
On a certain street, there are towers, numbered consecutively from to . Each tower has its own height , expressed in meters.
For a consecutive subsequence of towers numbered , we say that the tower with number () is good in that subsequence if it holds that , where denotes the greatest common divisor of the set of positive integers .
Your task is to determine, for each , the size of the largest consecutive subsequence in which the tower with number is good, where the size of a consecutive subsequence is defined as the number of towers in that subsequence.
Input Format
In the first line, there is an integer (), the number of towers.
In the second line, there are integers, in order, ().
Output Format
In a single line, print the answer to the above-mentioned question for each , in order.
6
3 6 6 6 1 3
4 3 3 3 6 1
5
10 2 10 15 5
1 3 1 1 3
Hint
Clarification of the first example:
In the first four towers, tower number is good. Towers with numbers , and are good in the subsequence they form themselves. Tower will be good in any arbitrary subsequence that contains it, so the answer will be 6 (the entire sequence).
Scoring
| Subtask | Points | Constraints |
|---|---|---|
| No additional constraints. |
京公网安备 11011102002149号