CF1416A.k-Amazing Numbers
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an array a consisting of n integers numbered from 1 to n .
Let's define the k -amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length k (recall that a subsegment of a of length k is a contiguous part of a containing exactly k elements). If there is no integer occuring in all subsegments of length k for some value of k , then the k -amazing number is −1 .
For each k from 1 to n calculate the k -amazing number of the array a .
输入格式
The first line contains one integer t ( 1≤t≤1000 ) — the number of test cases. Then t test cases follow.
The first line of each test case contains one integer n ( 1≤n≤3⋅105 ) — the number of elements in the array. The second line contains n integers a1,a2,…,an ( 1≤ai≤n ) — the elements of the array.
It is guaranteed that the sum of n over all test cases does not exceed 3⋅105 .
输出格式
For each test case print n integers, where the i -th integer is equal to the i -amazing number of the array.
输入输出样例
输入#1
3 5 1 2 3 4 5 5 4 4 4 4 2 6 1 3 1 5 3 1
输出#1
-1 -1 3 2 1 -1 4 4 4 2 -1 -1 1 1 1 1