#P9178. [COCI 2022/2023 #5] Diskurs
[COCI 2022/2023 #5] Diskurs
Problem Description
You are given non-negative integers , each of which is less than .
For each number, you need to find its maximum Hamming distance to the other elements in the array.
The Hamming distance between two non-negative integers is defined as the number of positions where their binary representations differ (adding leading zeros if necessary).
Formally, for each , compute:
$$\max\limits_{1\leq j\leq n} \operatorname{hamming}(a_i,a_j)$$Input Format
The first line contains two integers and 。
The second line contains numbers 。
Output Format
Output one line with integers. The -th integer represents the maximum Hamming distance between and the other elements in the array.
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
Hint
| Subtask | Constraints | |
|---|---|---|
| Sample only | ||
| None | ||
Translated by ChatGPT 5