151B.md (4433B)
1 Source: https://codeforces.com/problemset/problem/151/B 2 3 B. Phone Numbers 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 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. 22 23 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). 24 25 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. 26 27 Input 28 29 The first line contains an integer *n* (1 ≤ *n* ≤ 100) — the number of friends. 30 31 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. 32 33 Output 34 35 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. 36 37 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. 38 39 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. 40 41 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. 42 43 Examples 44 45 Input 46 47 ``` 48 4 49 2 Fedorov 50 22-22-22 51 98-76-54 52 3 Melnikov 53 75-19-09 54 23-45-67 55 99-99-98 56 7 Rogulenko 57 22-22-22 58 11-11-11 59 33-33-33 60 44-44-44 61 55-55-55 62 66-66-66 63 95-43-21 64 3 Kaluzhin 65 11-11-11 66 99-99-99 67 98-65-32 68 ``` 69 70 Output 71 72 ``` 73 If you want to call a taxi, you should call: Rogulenko. 74 If you want to order a pizza, you should call: Fedorov, Rogulenko, Kaluzhin. 75 If you want to go to a cafe with a wonderful girl, you should call: Melnikov. 76 ``` 77 78 Input 79 80 ``` 81 3 82 5 Gleb 83 66-66-66 84 55-55-55 85 01-01-01 86 65-43-21 87 12-34-56 88 3 Serega 89 55-55-55 90 87-65-43 91 65-55-21 92 5 Melnik 93 12-42-12 94 87-73-01 95 36-04-12 96 88-12-22 97 82-11-43 98 ``` 99 100 Output 101 102 ``` 103 If you want to call a taxi, you should call: Gleb. 104 If you want to order a pizza, you should call: Gleb, Serega. 105 If you want to go to a cafe with a wonderful girl, you should call: Melnik. 106 ``` 107 108 Input 109 110 ``` 111 3 112 3 Kulczynski 113 22-22-22 114 65-43-21 115 98-12-00 116 4 Pachocki 117 11-11-11 118 11-11-11 119 11-11-11 120 98-76-54 121 0 Smietanka 122 ``` 123 124 Output 125 126 ``` 127 If you want to call a taxi, you should call: Pachocki. 128 If you want to order a pizza, you should call: Kulczynski, Pachocki. 129 If you want to go to a cafe with a wonderful girl, you should call: Kulczynski. 130 ``` 131 132 Note 133 134 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. 135 136 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.