Diskurs

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

You are given nn non negative integers a_1,a_2,,a_na\_1, a\_2, \dots , a\_n less than 2m2^m. For each of them you are to find the maximum possible hamming distance between it and some other element of the array aa.

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 ii calculate: max_1jnhamming(a_i,a_j)\max\_{1 \le j \le n}hamming(a\_i, a\_j)

입력

The first line contains two integers nn and mm (1n2m1 ≤ n ≤ 2^m, 1m201 ≤ m ≤ 20).

The second line contains nn numbers a_ia\_i (0a_i<2m0 ≤ a\_i < 2^m)

출력

Output nn numbers seperated with spaces, where the ii-th number is the maximum hamming distance between a_ia\_i and some other number in aa.

힌트

Clarification of the third example: The numbers 33, 44, 66, 1010 can be represented as 00110011, 01000100, 01100110, 10101010, in binary. Numbers 33 and 44 differ at 33 places, same as numbers 44 and 1010. On the other hand, the number 66 differs in at most 22 places with all other numbers.