-
Notifications
You must be signed in to change notification settings - Fork 0
/
q53.cpp
82 lines (78 loc) · 1.36 KB
/
q53.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
using namespace std;
#define mod 1000000007
#define ll long long int
double pi=3.141592653589793238;
const int M = 1e9+7;
const int Nmax=5005;
const int MM = 1e7+1;
int main(){
int T=1;
//cin>>T;
while(T--){
int n;
cin>>n;
string s[n];
int t[n],d[n],g[n];
for(int z=0;z<n;z++){
int a;
t[z]=0;d[z]=0;g[z]=0;
cin>>a>>s[z];
while(a--){
ll p=0,q=0,r=0,k=1;
scanf("%d-%d-%d",&p,&q,&r);
p=(p*100+q)*100+r;
q=p;r=p%10;p/=10;
for(int i=0;i<5;i++){
if(r!=p%10) {k=0;break;}
r=p%10;
p/=10;
}
if(k){t[z]++;continue;}
p=q;r=p%10;p/=10;k=1;
for(int i=0;i<5;i++){
if(r>=p%10) {k=0;break;}
r=p%10;
p/=10;
}
if(k)d[z]++;
else g[z]++;
}
}
int tm=t[0],dm=d[0],gm=g[0];
for(int i=1;i<n;i++){
if(t[i]>tm)tm=t[i];
if(d[i]>dm)dm=d[i];
if(g[i]>gm)gm=g[i];
}
cout<<"If you want to call a taxi, you should call: ";
int c=0;
for(int i=0;i<n;i++)
if(t[i]==tm){
if(c>0)cout<<", ";
cout<<s[i];
c=1;
}
cout<<".\n";
cout<<"If you want to order a pizza, you should call: ";
c=0;
for(int i=0;i<n;i++)
if(d[i]==dm){
if(c>0)cout<<", ";
cout<<s[i];
c=1;
}
cout<<".\n";
cout<<"If you want to go to a cafe with a wonderful girl, you should call: ";
c=0;
for(int i=0;i<n;i++)
if(g[i]==gm){
if(c>0)cout<<", ";
cout<<s[i];
c=1;
}
cout<<".\n";
}
return 0;
}
/*_*/