Start: Dec, 04, 2016 12:00:00
杭州师范大学第十届程序设计竞赛—正式
End: Dec, 04, 2016 17:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 1ms
Memory: 1704kB
In contest: 1075

#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<math.h>

using namespace std;

struct hznu{
	char name[20];
}name[300];
int main(){
	int n,i;
	cin>>n;
	string n1,n2,n3;
	int tot=0;
	int cof[200]={0},keyb[200]={0},game[200]={0}; 
	for(int j=0;j<n;j++){
		int m;//电话的数量 
		cin>>m>>name[tot++].name;
		int m1,m2,m3;
		char ch;
		while(m--){
			scanf("%d%c%d%c%d",&m1,&ch,&m2,&ch,&m3);
			if(m1==m2&&m2==m3)keyb[tot-1]++;
			else if(m1/10>m1%10&&m1%10>m2/10&&m2/10>m2%10&&m2%10>m3/10&&m3/10>m3%10) game[tot-1]++;
			else cof[tot-1]++;
		}
	}	
	int maxcof=-1,maxkey=-1,maxgame=-1;
	int locof,lokey,logame;
	for(i=0;i<n;i++){
		if(cof[i]>maxcof){
			maxcof=cof[i];
			locof=i;
		}
		if(keyb[i]>maxkey){
			maxkey=keyb[i];
			lokey=i;
		}
		if(game[i]>maxgame){
			maxgame=game[i];
			logame=i;
		}
	}
	int numcof=0,numkey=0,numgame=0;
	for(i=0;i<n;i++){
		if(cof[i]==maxcof)numcof++;
		if(keyb[i]==maxkey)numkey++;
		if(game[i]==maxgame)numgame++;
	}
	
	
	cout<<"If you want to have a keyboard, you should call:";
	int tem=0,has=0;
	int bookkey[110]={0},bookgame[110]={0},bookcof[110]={0};
	while(tem<numkey){
		for(i=0;i<n;i++){
			if(keyb[i]==maxkey){
				if(bookkey[i]==0&&has++)cout<<", "<<name[i].name;
				else cout<<" "<<name[i].name;
				tem++;
				bookkey[i]=1;
			}
		}
	}
	has=0;
	cout<<"."<<endl;
	cout<<"If you want to order a Watchdog2, you should call:";
	tem=0;
	while(tem<numgame){
		for(i=0;i<n;i++){
			if(game[i]==maxgame){
				if(has++&&bookgame[i]==0)cout<<", "<<name[i].name;
				else cout<<" "<<name[i].name;
				tem++;
				bookgame[i]=1;
			}
		}
	}
	tem=0;
	cout<<"."<<endl;
	cout<<"If you want to have a cup of coffee with a girl, you should call:";
	has=0;
	while(tem<numcof){
		for(i=0;i<n;i++){
			if(cof[i]==maxcof){
				if(has++&&bookcof[i]==0)cout<<", "<<name[i].name;
				else cout<<" "<<name[i].name;
				tem++;
				bookcof[i]=1;
			}
		}
	}
	cout<<"."<<endl;
}