Making Mexes
시간 제한: 2000ms메모리 제한: 2048MB출처: USACO 2025 February BronzeBOJ 33736
문제
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 .
예제
예제 1
입력
4 2 2 2 0
출력
1 0 3 1 2
코드를 제출하려면 로그인하세요.