CF637C.Promocodes with Mistakes
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
新年特惠期间,“苏迪斯拉夫酒吧”推出了 n 个促销码。每个促销码恰好由六位数字组成,可凭此在“蚊子庇护所”酒吧免费兑换一杯鸡尾酒。显然,所有促销码互不相同。
由于“蚊子庇护所”酒吧仅在上午 9 点开门,而苏迪斯拉夫的派对通常早在早上 6 点便已开始,因此在输入促销码时极易出错。我们需要计算最大的 k 值,使得当促销码最多存在 k 处错误时,仍能被唯一识别。其中,k = 0 表示必须完全准确地输入促销码。
本题中,“错误”定义为输入了错误的数字。例如,相对于促销码 “123456”,输入值 “123465” 包含两处错误。无论错误数量多少,输入值始终恰好为六位数字。
输入格式
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".
输出的第一行包含一个数字 n(1≤n≤1000)—— 表示优惠码的数量。
接下来的 n 行中,每行包含一个由恰好 6 位数字组成的优惠码。保证所有优惠码互不相同。优惠码可以以数字 “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.
输出最大的 k(显然,k 不超过优惠码的长度),使得任意优惠码在最多有 k 个错误的情况下仍能被唯一识别。
输入输出样例
输入#1
2 000000 999999
输出#1
2
输入#2
6 211111 212111 222111 111111 112111 121111
输出#2
0
说明/提示
In the first sample k < 3, so if a bar customer types in value "090909", then it will be impossible to define which promocode exactly corresponds to it.
在第一个样例中,k<3,因此如果酒吧顾客输入值 “090909”,则无法确定它具体对应哪一个促销码。
输入解题思路,AI测评打分。不知道怎么写?