Logo
(追記) (追記ここまで)

27909번 - Diskurs 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB129645355.208%

문제

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$.

제한

서브태스크

번호배점제한
120

$m ≤ 10$

225

$m ≤ 16$

325

No additional constraints.

예제 입력 1

4 4
9 12 9 11

예제 출력 1

2 3 2 3

예제 입력 2

4 4
5 7 3 9

예제 출력 2

2 3 2 3

예제 입력 3

4 4
3 4 6 10

예제 출력 3

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.

출처

Contest > Croatian Open Competition in Informatics > COCI 2022/2023 > Contest #5 2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /