Longest Increasing Subsequence
题号:NC52849
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

Bobo learned how to compute Longest Increasing Subsequence (LIS) in in ICPCCamp.

For those who did not attend ICPCCamp as Bobo,
recall is defined as where denotes the exclusive-or (XOR) and f is calculated as follows.
for i in [1, 2, ..., n]  f[i] = 1
for j in [1, 2, ..., i - 1]
    if a[j] < a[i] then
          f[i] = max(f[i], f[j] + 1)

Given sequence , Bobo would like to find
where B_i is the sequence after removing the i-th element from A.

输入描述:

The input contains zero or more test cases and is terminated by end-of-file. For each test case:

The first line contains an integer n.
The second line contains n integers .

*
*
* The number of test cases does not exceed 10.

输出描述:

For each case, output n integers which denote .
示例1

输入

复制
5
2 5 3 1 4

输出

复制
5 13 0 8 0