시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 128 MB 194 67 42 31.343%

문제

어떤 길이가 양의 정수인 수열은 잘생긴 GCD 라는 값을 가질 수 있다. 잘생긴 GCD란 그 수열의 모든 원소들의 최대공약수에 수열의 길이를 곱한 값으로 정의된다.

당신의 임무는 수열이 주어질 때(a1, ... , an) 그 수열의 연속된 부분수열들의 잘생긴 GCD 중 가장 큰 값을 구하는 것이다.

입력

입력은 여러개의 테스트 케이스로 이루어진다. 첫 줄에는 테스트 케이스의 수를 의미하는 T 가 주어진다. 각 각의 테스트 케이스들은 두 줄로 구성되는데,  첫 줄은 수열의 크기 n ( 1 ≤ n ≤ 100 000 )이 주어진다. 두 번째 줄은 수열 a1, a2, ... , an 이 하나의 공백을 사이에 두고 주어지고 수열의 값은 1 이상 1,000,000,000,000 이하의 값을 가진다.

출력

각 각의 테스트 케이스에서 주어지는 수열의 연속 된 부분수열 중 잘생긴 GCD의 값이 가장 큰 수열의 잘생긴 GCD를 출력한다.

예제 입력 1

1
5
30 60 20 20 20

예제 출력 1

80
W3sicHJvYmxlbV9pZCI6Ijk1MzciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM3OThcdWMwZGRcdWFlMzQgR0NEIiwiZGVzY3JpcHRpb24iOiI8cD5cdWM1YjRcdWI1YTQgXHVhZTM4XHVjNzc0XHVhYzAwIFx1YzU5MVx1Yzc1OCBcdWM4MTVcdWMyMThcdWM3NzggXHVjMjE4XHVjNWY0XHVjNzQwIFx1Yzc5OFx1YzBkZFx1YWUzNCBHQ0QgXHViNzdjXHViMjk0IFx1YWMxMlx1Yzc0NCBcdWFjMDBcdWM5YzggXHVjMjE4IFx1Yzc4OFx1YjJlNC4gXHVjNzk4XHVjMGRkXHVhZTM0IEdDRFx1Yjc4MCBcdWFkZjggXHVjMjE4XHVjNWY0XHVjNzU4IFx1YmFhOFx1YjRlMCBcdWM2ZDBcdWMxOGNcdWI0ZTRcdWM3NTggXHVjZDVj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