시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 1024 MB | 17 | 4 | 4 | 36.364% |
You are given $n$ non negative integers $a_1, a_2, \dots , a_n$ less than $2^m$. For each of them you are to find the maximum possible hamming distance between it and some other element of the array $a$.
The hamming distance of two non negative integers is defined as the number of positions in the binary representation of these numbers in which they differ (we add leading zeros if necessary).
Formally, for each $i$ calculate: $$\max_{1 \le j \le n}hamming(a_i, a_j)$$
The first line contains two integers $n$ and $m$ ($1 ≤ n ≤ 2^m$, $1 ≤ m ≤ 20$).
The second line contains $n$ numbers $a_i$ ($0 ≤ a_i < 2^m$)
Output $n$ numbers seperated with spaces, where the $i$-th number is the maximum hamming distance between $a_i$ and some other number in $a$.
번호 | 배점 | 제한 |
---|---|---|
1 | 20 | $m ≤ 10$ |
2 | 25 | $m ≤ 16$ |
3 | 25 | No additional constraints. |
4 4 9 12 9 11
2 3 2 3
4 4 5 7 3 9
2 3 2 3
4 4 3 4 6 10
3 3 2 3
Clarification of the third example: The numbers $3$, $4$, $6$, $10$ can be represented as $0011$, $0100$, $0110$, $1010$, in binary. Numbers $3$ and $4$ differ at $3$ places, same as numbers $4$ and $10$. On the other hand, the number $6$ differs in at most $2$ places with all other numbers.