logo AlgoBeat OnlineJudge
登录 注册

#215697. [2019 KAIST RUN Spring] Increasing Sequence

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 .

输入格式

The first line contains an integer . ().

The next line contains integers denoting the permutation. (, all s are distinct).

输出格式

Print integers, separated by spaces, denoting the answers for .

样例

样例输入 1

1
1

样例输出 1

0

样例输入 2

6
1 2 3 4 5 6

样例输出 2

5 5 5 5 5 5

样例输入 3

6
6 5 4 3 2 1

样例输出 3

0 0 0 0 0 0

样例输入 4

4
2 1 4 3

样例输出 4

0 0 0 0

样例输入 5

9
1 2 3 6 5 4 7 8 9

样例输出 5

5 5 5 6 6 6 5 5 5