#P15635. [2019 KAIST RUN Spring] Increasing Sequence
[2019 KAIST RUN Spring] Increasing Sequence
Problem Description
You are given a permutation of size . For each , print the number of indices , which when removed, decreases the maximum possible length of an increasing subsequence that contains index .
Input Format
The first line contains an integer . ().
The next line contains integers denoting the permutation. (, all s are distinct).
Output Format
Print integers, separated by spaces, denoting the answers for .
1
1
0
6
1 2 3 4 5 6
5 5 5 5 5 5
6
6 5 4 3 2 1
0 0 0 0 0 0
4
2 1 4 3
0 0 0 0
9
1 2 3 6 5 4 7 8 9
5 5 5 6 6 6 5 5 5