#P9858. Perfect square number
Perfect square number
Perfect square number
Problem Description
You have an array of elements , . You have an operation that can modify the value of a certain position to any of the values in . (You can only perform it once) Find the maximum number of intervals that satisfy the interval sum is a Perfect square number.
Input
The description of the test cases follows. The first line contains one integer (). The second line contains integers ().
Output
For each test case, output the maximum number.
Sample Input
3
1 1 1
Sample Output
4
Hint
For the first query, change . For the second query, change .
Source
2023“钉耙编程”中国大学生算法设计超级联赛(6)