아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Guessing Game

시간 제한2초메모리 제한512 MB

요약
길이 k인 서로 다른 이진 문자열 n개가 주어질 때, 어떤 문자열이 선택되었든 항상 구별해 내는 데 필요한 최소 질문 수를 구한다.
난이도

보통10점 중 7점

유형
비트 연산, 분할 정복, 그리디, 재귀
정답자
아직 제출이 없습니다

문제

Guessing Game is Alice's favorite game for two players. This game is played with a deck containing a number of cards, each having a sequence of zeroes and ones written on it. The lengths of all sequences on the cards are equal.

In Guessing Game Alice picks at random a card from the deck, and the other player attempts to determine what sequence is written on the card, by asking Alice a series of questions of the form "What is the ii-th digit of the sequence?". After each such question Alice answers (truthfully) to the question, and the second player may ask another question, or try to guess the sequence on the card. The second player can only guess once, so if his guess is correct, he wins, otherwise he loses.

Alice challenged you to play the game and win by asking as few questions as possible.

Given all the sequences that appear on the cards, find the minimal number of questions needed to uniquely determine the sequence, no matter what card is picked by Alice.

입력

The first line of input contains the number of test cases zz (1≤z≤201 \leq z \leq 20). The descriptions of the test cases follow.

The first line of every test case contains two integers n,kn, k (1≤n≤2k;1≤k≤131 \leq n \leq 2^k; 1 \leq k \leq 13), denoting the number of cards and the length of all sequences appearing on the cards respectively. Each of the following nn lines contains a string of length kk consisting of zeroes and ones, describing the sequence on one card. No two sequences in a test case are equal.

출력

For each test case output one integer: the minimal number of questions the second player has to ask to win the game.

예제1

  1. 예제 1

    입력
    1
    4 3
    000
    100
    010
    011
    
    예상 출력
    2