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

34733번 - Brazilian FootXOR 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 2048 MB141311100.000%

문제

Alex is coaching the famous Brazilian FootXOR Club. For today’s training, they want to organize a match between two teams selected from the $N$ club members. To ensure a fair match, the two teams must be balanced.

Each club member has a set of abilities represented as a $K$-digit binary string. Each digit corresponds to a characteristic that the player may or may not have. Surprisingly, it is not the quantity of players having each characteristic that matters when deciding whether two teams are balanced: the important thing is the parity of that quantity.

Two teams are considered balanced if they have the same number of players and the bitwise XOR of the ability strings of all players in the first team is equal to the bitwise XOR of the ability strings of all players in the second team. Of course, each club member can only be assigned to at most one team and, for a match to happen, teams cannot be empty.

Alex is really busy right now. As their coaching assistant, you must determine how to assign players to the two teams. If it is impossible to fulfill the coach’s conditions, you must inform the coach accordingly.

입력

The first line contains two integers $N$ and $K$ (1ドル ≤ N, K ≤ 1500$), indicating respectively the number of club members and the number of binary digits used to represent their abilities. Each club member is identified by a distinct integer from 1ドル$ to $N$.

The $i$-th of the next $N$ lines contains a $K$-digit binary string $A_i,ドル representing the abilities of club member $i$. Note that $A_i$ has a fixed length and so it may contain leading zeros.

출력

Output a single line with a string of length $N$ if it is possible to fulfill the coach’s conditions. In this case, the $i$-th character of the string must be a digit “1”, “2” or “0”, indicating respectively that club member $i$ is assigned to the first team, to the second team, or to none of the two teams. If there are multiple solutions, output any of them.

If the coach’s conditions cannot be honored, output the character “*” (asterisk) instead.

제한

예제 입력 1

5 3
101
001
010
011
000

예제 출력 1

01221

예제 입력 2

3 2
01
10
11

예제 출력 2

*

예제 입력 3

4 3
011
000
100
011

예제 출력 3

1002

예제 입력 4

1 3
000

예제 출력 4

*

노트

출처

ICPC > Regionals > Latin America > Latin America Championship > The 2025 ICPC Latin America Championship B번

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

출처

대학교 대회

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

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