Dolls | 프로그래밍의 벗 PivotOJ
PivotOJ

Dolls

시간 제한: 1000ms메모리 제한: 1024MB출처: NOI 2023 QualificationBOJ 28492

문제

Marc is teaching some children about objects with different sizes. To demonstrate this concept, he will be using dolls. These dolls are hollow on the inside, so smaller dolls can be placed inside larger ones.

Each doll has a certain size. A doll of size xx can fit inside another doll of size yy if y - x ≥ 2. In other words, a smaller doll can fit in a larger doll if the difference in size between the larger doll and the smaller doll is at least 22.

A doll stack is formed by selecting some dolls that Marc has and repeatedly fitting the smallest doll into the second smallest doll until only one doll is left. The size of a doll stack is the number of dolls used to create it.

There are n days. On the iith (1 ≤ i ≤ n) day, Marc will buy a doll of size a[i]a[i]. After buying the doll, he will try to construct a doll stack with the maximum number of dolls. Help Marc compute, for each day, the maximum size of a doll stack using the dolls available on that day.

입력

The first line of input contains exactly 11 integer, nn.

The second line contain nn integers a[1],a[2],,a[n]a[1], a[2], \dots , a[n], representing the sizes of the dolls bought on each of the nn days.

출력

The output should contain nn integers on a single line and separated by spaces. The ii-th integer should be the maximum size of a doll stack using the dolls available on that day.

예제

예제 1

입력
5
1 2 3 4 5
출력
1 1 2 2 3

예제 2

입력
5
2 4 6 8 10
출력
1 2 3 4 5

예제 3

입력
5
3 3 1 3 2
출력
1 1 2 2 2
코드를 제출하려면 로그인하세요.