300791: CF151B. Phone Numbers

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

Description

Phone Numbers

题意翻译

## 题目描述 Nvodsk 的冬天刺骨般的冷!于是一行 $n$ 个朋友们会坐出租车,点一个披萨,然后给女生打电话。这个城市中的电话由三组数字组成(如 12-34-56)。每个朋友都有一本大小为 $s_{i}$(此为电话号码的数量)的电话簿。出租车司机的电话号由六个相同的数字构成(如 22-22-22),披萨外卖的电话则由六个递减的数字构成(如 98-73-21),剩下的号码都是女生的电话。 现在你朋友的电话簿都交到了你手里。计算一下当你想做某件事时最好去找谁(有着最多相应类型的电话号码的人)。 如果一个人的电话簿中同一个电话号码出现了两次,你也需要计数两次。也就是说,你需要考虑每个号码出现在电话簿中的次数。 ## 输入输出格式 ### 输入格式: 第一行包含一个整数 $n$($1\le n\le 100$) 为朋友的数量。 接下来的 $n$ 组数据用来描述每个朋友的电话簿。每一组数据的格式如下: 第一行包含一个整数 $s_{i}$ 和一个字符串 $name_{i}$($0\le s_{i}\le 100$),用以表示第 $i$ 个朋友的电话簿中的电话号码的数量和第 $i$ 个朋友的名字。名字为一个由大写和小写拉丁字母组成的不超过 20 个字符的非空字符串。接下来的 $s_{i}$ 行为形如“XX-XX-XX”的电话号码,其中 X 为 $0$ 到 $9$ 之间的任意数字。 ### 输出格式: 在第一行输出“If you want to call a taxi, you should call: ”。然后输出所有朋友中拥有出租车司机电话号码最多的朋友的名字。 在第二行输出“If you want to order a pizza, you should call: ”。然后输出所有朋友中拥有披萨外卖电话号码最多的朋友的名字。 在第三行输出“If you want to go to a cafe with a wonderful girl, you should call: ”。然后输出所有朋友中拥有女生电话号码最多的朋友的名字。 按照输入数据给出的顺序输出名字。用逗号(,)和空格将两个连续的名字隔开。每一行需要以一个点(.)结束。有关输出格式的说明请看输出样例。必须严格遵守输出格式,不允许有多余的空格。 ## 说明 第一个样例中有四个朋友。Fedorov 的电话簿包含一个出租车司机的电话号码和一个披萨外卖的电话号码,Melnikov 的电话簿只有 $3$ 个女孩的电话号码,而Rogulenko 的电话簿则有 $6$ 个出租车司机的电话号码和一个披萨外卖的电话号码,Kaluzhin 的电话簿有 $2$ 个出租车司机的电话号码和一个披萨外卖的电话号码。 因此,如果你想要打出租车,显然你应该给 Rogulenko 打电话,如果你想要定个披萨,你可以给 Rogulenko、Fedorov、Kaluzhin 中的任何一个打电话(他们每个人都只有一个电话号码)。Melnikov 则有最多的女生的电话号码。

题目描述

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.

输入输出格式

输入格式


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 $ .

输出格式


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.

Input

题意翻译

## 题目描述 Nvodsk 的冬天刺骨般的冷!于是一行 $n$ 个朋友们会坐出租车,点一个披萨,然后给女生打电话。这个城市中的电话由三组数字组成(如 12-34-56)。每个朋友都有一本大小为 $s_{i}$(此为电话号码的数量)的电话簿。出租车司机的电话号由六个相同的数字构成(如 22-22-22),披萨外卖的电话则由六个递减的数字构成(如 98-73-21),剩下的号码都是女生的电话。 现在你朋友的电话簿都交到了你手里。计算一下当你想做某件事时最好去找谁(有着最多相应类型的电话号码的人)。 如果一个人的电话簿中同一个电话号码出现了两次,你也需要计数两次。也就是说,你需要考虑每个号码出现在电话簿中的次数。 ## 输入输出格式 ### 输入格式: 第一行包含一个整数 $n$($1\le n\le 100$) 为朋友的数量。 接下来的 $n$ 组数据用来描述每个朋友的电话簿。每一组数据的格式如下: 第一行包含一个整数 $s_{i}$ 和一个字符串 $name_{i}$($0\le s_{i}\le 100$),用以表示第 $i$ 个朋友的电话簿中的电话号码的数量和第 $i$ 个朋友的名字。名字为一个由大写和小写拉丁字母组成的不超过 20 个字符的非空字符串。接下来的 $s_{i}$ 行为形如“XX-XX-XX”的电话号码,其中 X 为 $0$ 到 $9$ 之间的任意数字。 ### 输出格式: 在第一行输出“If you want to call a taxi, you should call: ”。然后输出所有朋友中拥有出租车司机电话号码最多的朋友的名字。 在第二行输出“If you want to order a pizza, you should call: ”。然后输出所有朋友中拥有披萨外卖电话号码最多的朋友的名字。 在第三行输出“If you want to go to a cafe with a wonderful girl, you should call: ”。然后输出所有朋友中拥有女生电话号码最多的朋友的名字。 按照输入数据给出的顺序输出名字。用逗号(,)和空格将两个连续的名字隔开。每一行需要以一个点(.)结束。有关输出格式的说明请看输出样例。必须严格遵守输出格式,不允许有多余的空格。 ## 说明 第一个样例中有四个朋友。Fedorov 的电话簿包含一个出租车司机的电话号码和一个披萨外卖的电话号码,Melnikov 的电话簿只有 $3$ 个女孩的电话号码,而Rogulenko 的电话簿则有 $6$ 个出租车司机的电话号码和一个披萨外卖的电话号码,Kaluzhin 的电话簿有 $2$ 个出租车司机的电话号码和一个披萨外卖的电话号码。 因此,如果你想要打出租车,显然你应该给 Rogulenko 打电话,如果你想要定个披萨,你可以给 Rogulenko、Fedorov、Kaluzhin 中的任何一个打电话(他们每个人都只有一个电话号码)。Melnikov 则有最多的女生的电话号码。

加入题单

算法标签: