F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Inversion

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1410    Accepted Submission(s): 855


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}$.
 

Sample Input
2 4 1 2 3 4 4 1 4 2 3
 

Sample Output
3 4 3 2 4 4
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-25 23:24:29, Gzip enabled