Making Mexes
시간 제한2초메모리 제한2048 MB
각 i=0부터 N까지, 배열이 0부터 i-1을 모두 포함하고 i를 포함하지 않도록 바꿔야 하는 원소 개수의 최솟값을 구한다.
문제
You are given an array of non-negative integers (). In one operation, you can change any element of to any non-negative integer.
The mex of an array is the minimum non-negative integer that it does not contain. For each in the range to inclusive, compute the minimum number of operations you need in order to make the mex of equal .
입력
The first line contains .
The next line contains .
출력
For each in the range to , output the minimum number of operations for on a new line. Note that it is always possible to make the mex of equal to any in the range to .