Inversion

TimeLimit:2000MS  MemoryLimit:65536KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Give an array A, the index starts from 1.
Now we want to know $B_{i}= \max\limits_{i\nmid j}A_{j} $ , $i \geq 2$.
Input
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 $A_{i}$.

Limits
$T \leq 20$
$2 \leq n \leq 100000$
$1 \leq Ai \leq 1000000000$
$\sum{n} \leq 700000$
Output
For each test case output one line contains n-1 integers, separated by space, ith number is $B_{i+1}$.
SampleInput
2
4
1 2 3 4
4
1 4 2 3
SampleOutput
3 4 3
2 4 4
Submit
题目统计信息详细
总AC数2
通过人数2
尝试人数4
总提交量4
AC率50.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: