303290: CF637C. Promocodes with Mistakes

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Promocodes with Mistakes

题意翻译

### 题目描述 在一个新年特价销售期间,苏迪斯拉夫酒吧提供了 n 个促销代码。每个促销代码包括准确的六位数字,并且能在“蚊子庇护所”免费享用一杯鸡尾酒。当然,所有的促销代码都是不尽相同的。 因为“蚊子庇护所”从九点才开始营业,而苏迪斯拉夫酒吧的派对最早往往六点就开始了,所以关于怎样输入准确无误的促销代码,就有可能会出现许多问题。那么就非常有必要确立一个最大值 k,使得如果促销代码的错误不超过 k 个,这个促销代码就是独一无二的。特别地,$k=0$ 表示所有的促销代码都必须准确无误地被输入。 一个错误指输入了一个错误的号码。比如说,代码“123465”对于代码“123456”来说有两个错误。无论代码的错误共有多少个,代码都由六位数字组成。 ### 输入格式 第一行输入促销代码的总数 n($1\leqslant n\leqslant 1000$)。 接下来的 n 行,每行输入一个促销代码,包括六位数字。保证所有的促销代码都是不同的,并且促销代码可以以数字“0”开头。 ### 输出格式 输出最大值 k(k 不能超过促销代码总长度),使得所有的促销代码输入时都能不超过 k 个错误。

题目描述

During a New Year special offer the "Sudislavl Bars" offered $ n $ promo codes. Each promo code consists of exactly six digits and gives right to one free cocktail at the bar "Mosquito Shelter". Of course, all the promocodes differ. As the "Mosquito Shelter" opens only at 9, and partying in Sudislavl usually begins at as early as 6, many problems may arise as to how to type a promotional code without errors. It is necessary to calculate such maximum $ k $ , that the promotional code could be uniquely identified if it was typed with no more than $ k $ errors. At that, $ k=0 $ means that the promotional codes must be entered exactly. A mistake in this problem should be considered as entering the wrong numbers. For example, value "123465" contains two errors relative to promocode "123456". Regardless of the number of errors the entered value consists of exactly six digits.

输入输出格式

输入格式


The first line of the output contains number $ n $ ( $ 1<=n<=1000 $ ) — the number of promocodes. Each of the next $ n $ lines contains a single promocode, consisting of exactly 6 digits. It is guaranteed that all the promocodes are distinct. Promocodes can start from digit "0".

输出格式


Print the maximum $ k $ (naturally, not exceeding the length of the promocode), such that any promocode can be uniquely identified if it is typed with at most $ k $ mistakes.

输入输出样例

输入样例 #1

2
000000
999999

输出样例 #1

2

输入样例 #2

6
211111
212111
222111
111111
112111
121111

输出样例 #2

0

说明

In the first sample $ k&lt;3 $ , so if a bar customer types in value "090909", then it will be impossible to define which promocode exactly corresponds to it.

Input

题意翻译

### 题目描述 在一个新年特价销售期间,苏迪斯拉夫酒吧提供了 n 个促销代码。每个促销代码包括准确的六位数字,并且能在“蚊子庇护所”免费享用一杯鸡尾酒。当然,所有的促销代码都是不尽相同的。 因为“蚊子庇护所”从九点才开始营业,而苏迪斯拉夫酒吧的派对最早往往六点就开始了,所以关于怎样输入准确无误的促销代码,就有可能会出现许多问题。那么就非常有必要确立一个最大值 k,使得如果促销代码的错误不超过 k 个,这个促销代码就是独一无二的。特别地,$k=0$ 表示所有的促销代码都必须准确无误地被输入。 一个错误指输入了一个错误的号码。比如说,代码“123465”对于代码“123456”来说有两个错误。无论代码的错误共有多少个,代码都由六位数字组成。 ### 输入格式 第一行输入促销代码的总数 n($1\leqslant n\leqslant 1000$)。 接下来的 n 行,每行输入一个促销代码,包括六位数字。保证所有的促销代码都是不同的,并且促销代码可以以数字“0”开头。 ### 输出格式 输出最大值 k(k 不能超过促销代码总长度),使得所有的促销代码输入时都能不超过 k 个错误。

加入题单

算法标签: