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

智能推荐

AndroidStudio无代码高亮解决办法_android studio 高亮-程序员宅基地

文章浏览阅读2.8k次。AndroidStudio 升级到 4.2.2 版本后,没有代码高亮了,很蛋疼。解决办法是:点开上方的 File,先勾选 Power Save Mode 再取消就可以了。_android studio 高亮

swift4.0 valueForUndefinedKey:]: this class is not key value coding-compliant for the key unity.'_forundefinedkey swift4-程序员宅基地

文章浏览阅读1k次。使用swift4.0整合Unity出现[ valueForUndefinedKey:]: this class is not key value coding-compliant for the key unity.'在对应属性前加@objc 即可。或者调回swift3.2版本_forundefinedkey swift4

Spring Security2的COOKIE的保存时间设置_springsecurity 设置cookie失效时间-程序员宅基地

文章浏览阅读1.3k次。http auto-config="true" access-denied-page="/common/403.htm"> intercept-url pattern="/login.**" access="IS_AUTHENTICATED_ANONYMOUSLY"/> form-login login-page="/login.jsp" defau_springsecurity 设置cookie失效时间

view滑动冲突解决实战篇2(外部拦截法)_viewpage2外部拦截事件-程序员宅基地

文章浏览阅读1.1k次。继上篇内部拦截法需求还是跟上篇一样。只不过这次用外部拦截法来解决;只要在父容器添加如下代码就可以解决了滑动冲突,很简单,套模板就行 // 分别记录上次滑动的坐标(onInterceptTouchEvent) private int mLastXIntercept = 0; private int mLastYIntercept = 0; @Override public bo_viewpage2外部拦截事件

汇编 堆栈 变量存储 指针_汇编语言栈指针-程序员宅基地

文章浏览阅读2.5k次,点赞7次,收藏9次。本文章系作者原创,未经许可,不得转载。汇编 堆栈 变量存储 指针先说栈的概念,栈其实也是一种。。。。。先说内存的概念吧。。。。。额 先说计算机吧,简单来说的话,可以把计算机理解成由CPU,内存,硬盘组成,而CPU内部又包括一种叫做内部寄存器的东西,包括 数据寄存器: AX,BX,CX,DX; 段寄存器: CS,DS,ES,SS; 指针与变址寄存器SP,BP,SI,DI; ..._汇编语言栈指针

架构师之路:从码农到架构师你差了哪些_web架构师-程序员宅基地

文章浏览阅读1w次,点赞14次,收藏56次。转载自 架构师之路:从码农到架构师你差了哪些 Web应用,最常见的研发语言是Java和PHP。 后端服务,最常见的研发语言是Java和C/C++。 大数据,最常见的研发语言是Java和Python。 可以说,Java是现阶段中国互联网公司中,覆盖度最广的研发语言,掌握了Java技术体系,不管在成熟的大公司,快速发展的公司,还是创业阶段的公司,都能有立足之地。有..._web架构师

随便推点

超级简单的Python爬虫入门教程(非常详细),通俗易懂,看一遍就会了_爬虫python入门-程序员宅基地

文章浏览阅读7.3k次,点赞6次,收藏36次。超级简单的Python爬虫入门教程(非常详细),通俗易懂,看一遍就会了_爬虫python入门

python怎么输出logistic回归系数_python - Logistic回归scikit学习系数与统计模型的系数 - SO中文参考 - www.soinside.com...-程序员宅基地

文章浏览阅读1.2k次。您的代码存在一些问题。首先,您在此处显示的两个模型是not等效的:尽管您将scikit-learn LogisticRegression设置为fit_intercept=True(这是默认设置),但您并没有这样做statsmodels一;来自statsmodels docs:默认情况下不包括拦截器,用户应添加。参见statsmodels.tools.add_constant。另一个问题是,尽管您处..._sm fit(method

VS2017、VS2019配置SFML_vsllfqm-程序员宅基地

文章浏览阅读518次。一、sfml官网下载32位的版本 一样的设置,64位的版本我没有成功,用不了。二、三、四以下这些内容拷贝过去:sfml-graphics-d.libsfml-window-d.libsfml-system-d.libsfml-audio-d.lib..._vsllfqm

vc——类似与beyondcompare工具的文本比较算法源代码_byoned compare 字符串比较算法-程序员宅基地

文章浏览阅读2.7k次。由于工作需要,要做一个类似bc2的文本比较工具,用红色字体标明不同的地方,研究了半天,自己写了一个简易版的。文本比较的规则是1.先比较文本的行数,2.再比较对应行的字符串的长度3.再比较每一个字符串是否相同。具体代码如下:其中m_basestr和m_mergestr里面存放是待比较的字符串int basecount=m_basestr.GetLength(); int mergec_byoned compare 字符串比较算法

aetna java_pom.xml-程序员宅基地

文章浏览阅读79次。xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">org.apacheapache174.0.0org.apache.atlasapache-atlas3.0.0-SNAPSHOTMetadata Management and Data Govern..._atlas.pom

生成随机数_<math.h>随机数-程序员宅基地

文章浏览阅读1.5k次。C语言中有可以产生随机数据的函数,需要添加 stdlib. h头文件与time.h头文件。首先在main函数开头加上“ srand(unsigned)time(NULL));",这个语句将生成随机数的种子(不懂也没关系,只要记住这个语句,并且知道 srand是初始化随机种子用的即可)。然后,在需要使用随机数的地方使用 rand()函数。下面是一段生成十个随机数的代码:程序代码:#incl..._随机数