Responsive image

问题 1846 --Inversion

1846: Inversion

时间限制: 4 Sec  内存限制: 128 MB
提交: 25  解决: 21
[提交][状态][讨论版][命题人:]

题目描述

Give an array A, the index starts from 1.
Now we want to know Bi=maxi∤jAj , i≥2.

输入描述

The first line of the input gives the number of test cases T; T test cases follow.
Each case begins with one line with one integer n : the size of array A.
Next one line contains n integers, separated by space, ith number is Ai.
Limits
T≤20
2≤n≤100000
1≤Ai≤1000000000
∑n≤700000

输出描述

For each test case output one line contains n-1 integers, separated by space, ith number is Bi+1.

样例输入

2
4
1 2 3 4
4
1 4 2 3

样例输出

3 4 3
2 4 4

来源

 

[提交][状态]
ACM算法攻关部