Applications-程序员宅基地

技术标签: ★-----------其他-----------  暴力  

Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu

Description

Recently, the ACM/ICPC team of Marjar University decided to choose some new members from freshmen to take part in the ACM/ICPC competitions of the next season. As a traditional elite university in ACM/ICPC, there is no doubt that application forms will fill up the mailbox. To constitute some powerful teams, coaches of the ACM/ICPC team decided to use a system to score all applicants, the rules are described as below. Please note that the score of an applicant is measured by pts, which is short for "points".

1. Of course, the number of solved ACM/ICPC problems of a applicant is important. Proudly, Marjar University have a best online judge system called Marjar Online Judge System V2.0, and in short, MOJ. All solved problems in MOJ of a applicant will be scored under these rules:

  • (1) The problems in a set, called MaoMao Selection, will be counted as 2.5 pts for a problem.
  • (2) The problems from Old Surgeon Contest, will be counted as 1.5 pts for a problem.There is no problem in MaoMao Selection from Old Surgeon Contest.
  • (3) Besides the problem from MaoMao Selection and Old Surgeon Contest, if the problem's id is a prime, then it will be counted as 1 pts.
  • (4) If a solved problem doesn't meet above three condition, then it will be counted as 0.3 pts.

2. Competitions also show the strength of an applicant. Marjar University holds the ACM/ICPC competition of whole school once a year. To get some pts from the competition, an applicant should fulfill rules as below:

  • The member of a team will be counted as 36 pts if the team won first prize in the competition.
  • The member of a team will be counted as 27 pts if the team won second prize in the competition.
  • The member of a team will be counted as 18 pts if the team won third prize in the competition.
  • Otherwise, 0 pts will be counted.

3. We all know that some websites held problem solving contest regularly, such as JapanJamZacaiForces and so on. The registered member of JapanJam will have a rating after each contest held by it. Coaches thinks that the third highest rating in JapanJam of an applicant is good to show his/her ability, so the scoring formula is:

Pts = max(0, (r - 1200) / 100) * 1.5

Here r is the third highest rating in JapanJam of an applicant.

4. And most importantly - if the applicant is a girl, then the score will be added by 33 pts.

The system is so complicated that it becomes a huge problem for coaches when calculating the score of all applicants. Please help coaches to choose the best M applicants!

Input

There are multiple test cases.

The first line of input is an integer T (1 ≤ T ≤ 10), indicating the number of test cases.

For each test case, first line contains two integers N (1 ≤ N ≤ 500) - the number of applicants and M (1 ≤ M ≤ N) - the number of members coaches want to choose.

The following line contains an integer R followed by R (0 ≤ R ≤ 500) numbers, indicating the id of R problems in MaoMao Selection.

And then the following line contains an integer S (0 ≤ S ≤ 500) followed by S numbers, indicating the id of S problems from Old Surgeon Contest.

The following line contains an integer Q (0 ≤ Q ≤ 500) - There are Q teams took part in Marjar University's competition.

Following Q lines, each line contains a string - team name and one integer - prize the team get. More specifically, 1 means first prize, 2 means second prize, 3 means third prize, and 0 means no prize.

In the end of each test case, there are N parts. In each part, first line contains two strings - the applicant's name and his/her team name inMarjar University's competition, a char sex - M for male, F for female and two integers P (0 ≤ P ≤ 1000) - the number of problem the applicant solved, C (0 ≤ C ≤ 1000) - the number of competitions the applicant have taken part in JapanJam.

The following line contains P integers, indicating the id of the solved problems of this applicant.

And, the following line contains C integers, means the rating for C competitions the applicant have taken part in.

We promise:

  • The problems' id in MaoMao SelectionOld Surgeon Contest and applicant's solving list are distinct, and all of them have 4 digits (such as 1010).
  • All names don't contain spaces, and length of each name is less than 30.
  • All ratings are non-negative integers and less than 3500.

Output

For each test case, output M lines, means that M applicants and their scores. Please output these informations by sorting scores in descending order. If two applicants have the same rating, then sort their names in alphabet order. The score should be rounded to 3 decimal points.

Sample Input

1
5 3
3 1001 1002 1003
4 1004 1005 1006 1007
3
MagicGirl!!! 3
Sister's_noise 2
NexusHD+NexusHD 1
Edward EKaDiYaKanWen M 5 3
1001 1003 1005 1007 1009
1800 1800 1800
FScarlet MagicGirl!!! F 3 5
1004 1005 1007
1300 1400 1500 1600 1700
A NexusHD+NexusHD M 0 0


B None F 0 0


IamMM Sister's_noise M 15 1
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
3000

Sample Output

FScarlet 60.000
IamMM 44.300
A 36.000
题目很长 。看懂了题目就会觉得很简单,,,,然后又有坑。。哈哈。
 
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#define mod 1000000007
using namespace std;
int  MaoMao[10005];
int Surgeon[10005];

struct person
{
	char name[100];
	char teamname[100];
	char sex;
	int problems;
	int problem[1001];
	int contests;
	int contest[1001];
	double fenshu;
};
bool  sushu[10005];
person ren[1001];

int cmp(person a,person b)
{
	if ( a.fenshu>b.fenshu) return 1;
	else
		
		if  ( a.fenshu==b.fenshu)
			return strcmp(a.name,b.name)<0;
		
		
		return  0;
}
int main()
{
	
	
	int i,j,k,n,m,Q,r,t,s;
	sushu[1]=true;
	for (i=2;i<=10005;i++)
	{
		if (sushu[i]==false)
		{
			for (j=i*i;j<=10005;j+=i)
				sushu[j]=true;
		}
		
	}
	
	
	
	
	scanf("%d",&t);
	for (i=1;i<=t;i++)
	{
		string team[5][1005];
		memset(MaoMao,0,sizeof(MaoMao));
		
		memset(Surgeon,0,sizeof(Surgeon));
		
		//	memset(team,0,sizeof(team));   //此处menset会Segmentation Fault;可以用set
		scanf("%d%d",&n,&m);
		scanf("%d",&r);
		int tt;
		for (j=1;j<=r;j++)
		{
			scanf("%d",&tt);
			MaoMao[tt]=1;
		}
		
		scanf("%d",&s);
		for (j=1;j<=s;j++)
		{
			scanf("%d",&tt );
			Surgeon[tt]=1;
		}
		scanf("%d",&Q);
		
		char stmp[100];
		int tmp;
		int ok1=0;
		int ok2=0;
		int ok3=0;
		for (j=1;j<=Q;j++)// 此处一队可有多个名次,一个名次可以多个队拥有,不仅仅是一场比赛。算是一个坑
		{
			cin>>stmp;  
            cin>>tt; 
			if (tt==1)
				team[tt][++ok1]=stmp;
			if (tt==2)
				team[tt][++ok2]=stmp;
			if (tt==3)
				team[tt][++ok3]=stmp;
				/*if (tmp==1)
				strcpy(team[1],stmp);
				if (tmp==2)
				strcpy(team[2],stmp);
				if (tmp==3)
				strcpy(team[3],stmp);
			*/
			
			
		}
		string str;
		for (j=1;j<=n;j++)
		{
			ren[j].fenshu=0;
			scanf("%s",ren[j].name);
			
			cin>>str; 
			
			for (k=1;k<=ok1;k++)
			{
				if (str==team[1][k])  	ren[j].fenshu+=36;
			}
			for (k=1;k<=ok2;k++)
			{
				if (str==team[2][k])  	ren[j].fenshu+=27;
			}
			
			for (k=1;k<=ok3;k++)
			{
				if (str==team[3][k])  	ren[j].fenshu+=18;
			}
			
			
			
			
			getchar();
			scanf("%c",&ren[j].sex);
			if (ren[j].sex=='F')
				ren[j].fenshu+=33;
			
			scanf("%d%d",&ren[j].problems,&ren[j].contests);
			for (k=1;k<=ren[j].problems;k++)
			{
				scanf("%d",&ren[j].problem[k]);
				if ( MaoMao[ren[j].problem[k]] )
				{
					ren[j].fenshu+=2.5;
					continue;
				}
				if ( Surgeon[ren[j].problem[k]] )
				{
					ren[j].fenshu+=1.5;
					continue;
				}
				
				if (sushu[ren[j].problem[k]]==false)
					ren[j].fenshu+=1;
				else 
					ren[j].fenshu+=0.3;
				
				
			}
			
			
			
			for (k=1;k<=ren[j].contests;k++)
			{
				scanf("%d",&ren[j].contest[k]);
				
			}
			sort(ren[j].contest+1,ren[j].contest+ren[j].contests+1);  //1此处之前访问的是第三小。而不是第三大
			
			if (ren[j].contest[ren[j].contests-2]>1200 && ren[j].contests>=3)
			{
				ren[j].fenshu+=(double)(  (double)(  (double) ( ren[j].contest[ren[j].contests-2]-1200)  /100)*1.5);<span style="white-space:pre">	</span>//
			}
			
		}
		
		
		
		sort(ren+1,ren+n+1,cmp); //此处该先对分数排序再对名字排序
		for (k=1;k<=m;k++)
			printf("%s %.3lf\n",ren[k].name,ren[k].fenshu);
		
		
		
	}
	
	
	return 0;
}


版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/viphong/article/details/45148011

智能推荐

计算机等级错别字,word教学错别字制作方法(一)-程序员宅基地

文章浏览阅读148次。小学语文教学中经常要用到一些错别字的大幅挂图,我们可以利用下面两种方法制作所需的错别字图片,而不必跑商店去购。这里以制作错别字为例进行介绍。1.在Flash中制作运行Flash,新建一空白Flash文档,单击选中“文本工具(T)”按钮,在“属性”中设定字体为隶体、字号为300(可根据具体情况设定,字号大小直接输入即可),在编辑区中输入“吃”字,用箭头工具选中该文本框,用快捷键“Ctrl+B”将它打..._计算机考试如何该错字

EL和JSTL基本使用_jstl表达提交数据获取数据-程序员宅基地

文章浏览阅读2.1k次,点赞7次,收藏21次。讲解了el和jstl的基本使用,学会使用el和jstl的基本用法,能看懂别人写的el和jstl,并且能够自己编写一些el和jstl。_jstl表达提交数据获取数据

npm ERR!cb.apply is not a function_npm err! cb.apply is not a function-程序员宅基地

文章浏览阅读3.7k次,点赞2次,收藏5次。npm ERR!cb.apply is not a function_npm err! cb.apply is not a function

BeanDefinitionParsingException:Unnamed bean definition specifies neither 'class' nor 'parent'_idea 单测 application.properties文件解析报错 beandefinitio-程序员宅基地

文章浏览阅读1.2k次。BeanDefinitionParsingException:Unnamed bean definition specifies neither 'class' nor 'parent'由于:bean 没有配置完整,少了class等属性的配置 或者配置了空的bean_idea 单测 application.properties文件解析报错 beandefinitionparsinge

三国杀_三国杀博客-程序员宅基地

文章浏览阅读938次。杀的数量是闪的两倍。装诸葛连弩前可以先出一次杀(杀司马懿时)。黑色花色多为进攻的牌;方片多为闪和桃;寒冰剑攻击大乔时,大乔可以选择流离,寒冰剑的技能将对流离的角色使用;寒冰剑的弃牌类似于两次过河拆桥(不能被无懈);寒冰剑打司马懿比较合适;无懈可击的对象是目标锦囊,与角色无关;借刀杀人可以杀该锦囊使用者;诸葛连弩的技能不能被发动(出牌阶段);借刀杀人中反馈的是攻击的源头;不能无懈掉桃源结义;南蛮入侵_三国杀博客

B+树的插入、删除(附源代码)-程序员宅基地

文章浏览阅读3k次,点赞3次,收藏21次。B+ TreeIndexB+树的插入 B+树的删除 完整测试代码 BasicB+树和B树类似(有关B树:http://www.cnblogs.com/YuNanlong/p/6354029.html,区别主要在于叶节点,如果在父节点的Child数组中指向某一叶节点指针的下标为Index,则该叶节点中的最大数据值与其父节点中Key[Index]的值相等,并且除最右侧的_b+树插入删除源码

随便推点

linux用串口登陆,linux串口登陆-程序员宅基地

文章浏览阅读1.9k次。在这个互连网高速发展的时代, 企业内网络设备的安全和运行稳定也成为人们的焦点话题之一,在网络安全方面有句行话"技术不是万能药!".在整个安全问题的全方面考虑中,人才是最重要的环节.为此,非常多企业的重要服务器都没有输出或输入设备,就算有,也只是安装系统时使用,一旦投入生产式管理,基本依靠网络进行,网络毕竟不是这么可靠,如果服务器的网络瘫痪了,你正好需要远程解决网络的问题,那该怎么做?其实Linux..._服务器串口登录

数字图像处理总结(冈萨雷斯版)_冈萨雷斯数字图像处理-程序员宅基地

文章浏览阅读1.9w次,点赞64次,收藏787次。数字图像处理(冈萨雷斯版本)课程复习_冈萨雷斯数字图像处理

win10系统如何配置web服务器,如何在windows10下搭建web服务器-程序员宅基地

文章浏览阅读9.8k次,点赞3次,收藏31次。我们都知道Web服务器的使用,让很多的用户们实现了局域网内资源共享的方法,因为利用Web服务器,我们就可以将自己的信息上传到自己指定的服务器端,不仅可以实现资源共享,而且还有效地达到信息的同步,是一个非常不错的信息平台。那么如何在windows10下,成功地实现web服务器的搭建呢?系统堂官网告诉你在如何在windows10下搭建web服务器步骤如下所示:1.首先打开电脑的控制面板,选择并进入“程..._win10搭建web服务器

android微信打开app接口被封,android app使用微信登录接口回调没有被执行的问题研究...-程序员宅基地

文章浏览阅读223次。本人开发的一个app使用了sharesdk集成微信登录功能,在测试的过程中微信授权登录界面有调用,但是授权后原应用的回调没有被执行应用的包名是com.kimi.searcher首先,确认微信点击授权后有没有执行回调,方法是通过日志过滤activitymanager,日志中有出现04-16 13:27:43.345 1805-3279/? I/ActivityManager: START u0 {f..._app里面的接口被封禁原因

docker启动的nginx配置访问静态资源,访问失败的解决方法_docker启动nginx不能访问-程序员宅基地

文章浏览阅读453次,点赞11次,收藏6次。注意查看 nginx 的 error 日志,显示是 404。docker 比较特殊,它的 nginx 目录都是分散的,所以对于 nginx 配置文件中的root 路径最好写绝对路径,而且得是 docker 容器内的路径,如下。做了挂载映射的,不要写成宿主机的挂载路径了,要改成docker 容器内的路径!_docker启动nginx不能访问

Matlab之在函数里使用外部变量:全局变量和嵌套函数_matlab function 模块如何引用外部变量-程序员宅基地

文章浏览阅读1.4w次。函数里的变量自在函数内有效, 那么如何在函数内调用外部的变量呢?全局变量 globalglobal可以定义全局变量, 但要注意先定义, 再赋值. 否则会有警告:Warning: The value of local variables may have been changed to match the globals. Future versions of MATLAB will require that you declare a variable to be global before _matlab function 模块如何引用外部变量

推荐文章

热门文章

相关标签