CF151B.Phone Numbers
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Winters are just damn freezing cold in Nvodsk! That's why a group of n friends prefers to take a taxi, order a pizza and call girls. The phone numbers in the city consist of three pairs of digits (for example, 12-34-56). Each friend has a phonebook of size s__i (that's the number of phone numbers). We know that taxi numbers consist of six identical digits (for example, 22-22-22), the numbers of pizza deliveries should necessarily be decreasing sequences of six different digits (for example, 98-73-21), all other numbers are the girls' numbers.
You are given your friends' phone books. Calculate which friend is best to go to when you are interested in each of those things (who has maximal number of phone numbers of each type).
If the phone book of one person contains some number two times, you should count it twice. That is, each number should be taken into consideration the number of times it occurs in the phone book.
诺沃茨克的冬天冷得要命!因此,一群 n 个朋友更喜欢打车、点披萨和约女孩。该城市的电话号码由三对数字组成(例如:12-34-56)。每位朋友的通讯录大小为 si(即其通讯录中电话号码的个数)。已知出租车号码由六个完全相同的数字构成(例如:22-22-22);披萨外卖号码必须是由六个互不相同的数字组成的严格递减序列(例如:98-73-21);其余所有号码均为女孩的号码。
现给出你朋友们的通讯录。请计算:当你需要上述三类服务时,应分别联系哪位朋友(即,找出每种类型号码数量最多的朋友)。
若某人的通讯录中某个号码出现了两次,则该号码应被计为两次。换言之,每个号码在统计时应以其在通讯录中出现的次数为准。
输入格式
The first line contains an integer n (1 ≤ n ≤ 100) — the number of friends.
Then follow n data blocks that describe each friend's phone books. Each block is presented in the following form: first goes the line that contains integer s__i and string name__i (0 ≤ s__i ≤ 100) — the number of phone numbers in the phone book of the i-th friend and the name of the i-th friend. The name is a non-empty sequence of uppercase and lowercase Latin letters, containing no more than 20 characters. Next s__i lines contain numbers as "XX-XX-XX", where X is arbitrary digits from 0 to 9.
第一行包含一个整数 n(1≤n≤100)——朋友的数量。
接下来是 n 个数据块,每个数据块描述一位朋友的电话簿。每个数据块的形式如下:首先是一行,包含整数 si 和字符串 namei(0≤si≤100)——即第 i 位朋友电话簿中的电话号码数量及其姓名。姓名是由大小写拉丁字母组成的非空字符串,长度不超过 20 个字符。随后的 si 行每行包含一个形如 "XX-XX-XX" 的电话号码,其中 X 为任意数字(0 到 9)。
输出格式
In the first line print the phrase "If you want to call a taxi, you should call: ". Then print names of all friends whose phone books contain maximal number of taxi phone numbers.
In the second line print the phrase "If you want to order a pizza, you should call: ". Then print names of all friends who have maximal number of pizza phone numbers.
In the third line print the phrase "If you want to go to a cafe with a wonderful girl, you should call: ". Then print names of all friends who have maximal number of girls' phone numbers.
Print the names in the order in which they are given in the input data. Separate two consecutive names with a comma and a space. Each line should end with exactly one point. For clarifications concerning the output form, see sample tests. It is necessary that you follow the output form strictly. Extra spaces are not allowed.
第一行输出短语“如果想要叫出租车,你应该拨打:”。然后输出所有电话簿中包含最多出租车电话号码的好友姓名。
第二行输出短语“如果想要订披萨,你应该拨打:”。然后输出所有拥有最多披萨电话号码的好友姓名。
第三行输出短语“如果想要和一位可爱的女孩一起去咖啡馆,你应该拨打:”。然后输出所有拥有最多女孩电话号码的好友姓名。
请按输入数据中给出的顺序输出姓名;两个相邻姓名之间用逗号和一个空格分隔。每行结尾必须恰好有一个英文句点。有关输出格式的进一步说明,请参见样例测试。你必须严格遵循该输出格式;不允许出现额外空格。
输入输出样例
输入#1
4 2 Fedorov 22-22-22 98-76-54 3 Melnikov 75-19-09 23-45-67 99-99-98 7 Rogulenko 22-22-22 11-11-11 33-33-33 44-44-44 55-55-55 66-66-66 95-43-21 3 Kaluzhin 11-11-11 99-99-99 98-65-32
输出#1
If you want to call a taxi, you should call: Rogulenko. If you want to order a pizza, you should call: Fedorov, Rogulenko, Kaluzhin. If you want to go to a cafe with a wonderful girl, you should call: Melnikov.
输入#2
3 5 Gleb 66-66-66 55-55-55 01-01-01 65-43-21 12-34-56 3 Serega 55-55-55 87-65-43 65-55-21 5 Melnik 12-42-12 87-73-01 36-04-12 88-12-22 82-11-43
输出#2
If you want to call a taxi, you should call: Gleb. If you want to order a pizza, you should call: Gleb, Serega. If you want to go to a cafe with a wonderful girl, you should call: Melnik.
输入#3
3 3 Kulczynski 22-22-22 65-43-21 98-12-00 4 Pachocki 11-11-11 11-11-11 11-11-11 98-76-54 0 Smietanka
输出#3
If you want to call a taxi, you should call: Pachocki. If you want to order a pizza, you should call: Kulczynski, Pachocki. If you want to go to a cafe with a wonderful girl, you should call: Kulczynski.
说明/提示
In the first sample you are given four friends. Fedorov's phone book contains one taxi number and one pizza delivery number, Melnikov's phone book only has 3 numbers of girls, Rogulenko's one has 6 taxi numbers and one pizza delivery number, Kaluzhin's one contains 2 taxi numbers and one pizza delivery number.
Thus, if you need to order a taxi, you should obviously call Rogulenko, if you need to order a pizza you should call anybody of the following: Rogulenko, Fedorov, Kaluzhin (each of them has one number). Melnikov has maximal number of phone numbers of girls.
在第一个样例中,你有四位朋友。费多罗夫的通讯录中包含一个出租车号码和一个披萨外卖号码;梅尔尼科夫的通讯录中仅有 3 个女孩的电话号码;罗古连科的通讯录中有 6 个出租车号码和 1 个披萨外卖号码;卡卢任的通讯录中有 2 个出租车号码和 1 个披萨外卖号码。
因此,如果你需要叫出租车,显然应该给罗古连科打电话;如果你需要点披萨,则可以给以下任意一人打电话:罗古连科、费多罗夫、卡卢任(他们每人各有一个披萨外卖号码)。梅尔尼科夫拥有最多数量的女孩电话号码。
输入解题思路,AI测评打分。不知道怎么写?