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

智能推荐

从零开始搭建Hadoop_创建一个hadoop项目-程序员宅基地

文章浏览阅读331次。第一部分:准备工作1 安装虚拟机2 安装centos73 安装JDK以上三步是准备工作,至此已经完成一台已安装JDK的主机第二部分:准备3台虚拟机以下所有工作最好都在root权限下操作1 克隆上面已经有一台虚拟机了,现在对master进行克隆,克隆出另外2台子机;1.1 进行克隆21.2 下一步1.3 下一步1.4 下一步1.5 根据子机需要,命名和安装路径1.6 ..._创建一个hadoop项目

心脏滴血漏洞HeartBleed CVE-2014-0160深入代码层面的分析_heartbleed代码分析-程序员宅基地

文章浏览阅读1.7k次。心脏滴血漏洞HeartBleed CVE-2014-0160 是由heartbeat功能引入的,本文从深入码层面的分析该漏洞产生的原因_heartbleed代码分析

java读取ofd文档内容_ofd电子文档内容分析工具(分析文档、签章和证书)-程序员宅基地

文章浏览阅读1.4k次。前言ofd是国家文档标准,其对标的文档格式是pdf。ofd文档是容器格式文件,ofd其实就是压缩包。将ofd文件后缀改为.zip,解压后可看到文件包含的内容。ofd文件分析工具下载:点我下载。ofd文件解压后,可以看到如下内容: 对于xml文件,可以用文本工具查看。但是对于印章文件(Seal.esl)、签名文件(SignedValue.dat)就无法查看其内容了。本人开发一款ofd内容查看器,..._signedvalue.dat

基于FPGA的数据采集系统(一)_基于fpga的信息采集-程序员宅基地

文章浏览阅读1.8w次,点赞29次,收藏313次。整体系统设计本设计主要是对ADC和DAC的使用,主要实现功能流程为:首先通过串口向FPGA发送控制信号,控制DAC芯片tlv5618进行DA装换,转换的数据存在ROM中,转换开始时读取ROM中数据进行读取转换。其次用按键控制adc128s052进行模数转换100次,模数转换数据存储到FIFO中,再从FIFO中读取数据通过串口输出显示在pc上。其整体系统框图如下:图1:FPGA数据采集系统框图从图中可以看出,该系统主要包括9个模块:串口接收模块、按键消抖模块、按键控制模块、ROM模块、D.._基于fpga的信息采集

微服务 spring cloud zuul com.netflix.zuul.exception.ZuulException GENERAL-程序员宅基地

文章浏览阅读2.5w次。1.背景错误信息:-- [http-nio-9904-exec-5] o.s.c.n.z.filters.post.SendErrorFilter : Error during filteringcom.netflix.zuul.exception.ZuulException: Forwarding error at org.springframework.cloud..._com.netflix.zuul.exception.zuulexception

邻接矩阵-建立图-程序员宅基地

文章浏览阅读358次。1.介绍图的相关概念  图是由顶点的有穷非空集和一个描述顶点之间关系-边(或者弧)的集合组成。通常,图中的数据元素被称为顶点,顶点间的关系用边表示,图通常用字母G表示,图的顶点通常用字母V表示,所以图可以定义为:  G=(V,E)其中,V(G)是图中顶点的有穷非空集合,E(G)是V(G)中顶点的边的有穷集合1.1 无向图:图中任意两个顶点构成的边是没有方向的1.2 有向图:图中..._给定一个邻接矩阵未必能够造出一个图

随便推点

MDT2012部署系列之11 WDS安装与配置-程序员宅基地

文章浏览阅读321次。(十二)、WDS服务器安装通过前面的测试我们会发现,每次安装的时候需要加域光盘映像,这是一个比较麻烦的事情,试想一个上万个的公司,你天天带着一个光盘与光驱去给别人装系统,这将是一个多么痛苦的事情啊,有什么方法可以解决这个问题了?答案是肯定的,下面我们就来简单说一下。WDS服务器,它是Windows自带的一个免费的基于系统本身角色的一个功能,它主要提供一种简单、安全的通过网络快速、远程将Window..._doc server2012上通过wds+mdt无人值守部署win11系统.doc

python--xlrd/xlwt/xlutils_xlutils模块可以读xlsx吗-程序员宅基地

文章浏览阅读219次。python–xlrd/xlwt/xlutilsxlrd只能读取,不能改,支持 xlsx和xls 格式xlwt只能改,不能读xlwt只能保存为.xls格式xlutils能将xlrd.Book转为xlwt.Workbook,从而得以在现有xls的基础上修改数据,并创建一个新的xls,实现修改xlrd打开文件import xlrdexcel=xlrd.open_workbook('E:/test.xlsx') 返回值为xlrd.book.Book对象,不能修改获取sheett_xlutils模块可以读xlsx吗

关于新版本selenium定位元素报错:‘WebDriver‘ object has no attribute ‘find_element_by_id‘等问题_unresolved attribute reference 'find_element_by_id-程序员宅基地

文章浏览阅读8.2w次,点赞267次,收藏656次。运行Selenium出现'WebDriver' object has no attribute 'find_element_by_id'或AttributeError: 'WebDriver' object has no attribute 'find_element_by_xpath'等定位元素代码错误,是因为selenium更新到了新的版本,以前的一些语法经过改动。..............._unresolved attribute reference 'find_element_by_id' for class 'webdriver

DOM对象转换成jQuery对象转换与子页面获取父页面DOM对象-程序员宅基地

文章浏览阅读198次。一:模态窗口//父页面JSwindow.showModalDialog(ifrmehref, window, 'dialogWidth:550px;dialogHeight:150px;help:no;resizable:no;status:no');//子页面获取父页面DOM对象//window.showModalDialog的DOM对象var v=parentWin..._jquery获取父window下的dom对象

什么是算法?-程序员宅基地

文章浏览阅读1.7w次,点赞15次,收藏129次。算法(algorithm)是解决一系列问题的清晰指令,也就是,能对一定规范的输入,在有限的时间内获得所要求的输出。 简单来说,算法就是解决一个问题的具体方法和步骤。算法是程序的灵 魂。二、算法的特征1.可行性 算法中执行的任何计算步骤都可以分解为基本可执行的操作步,即每个计算步都可以在有限时间里完成(也称之为有效性) 算法的每一步都要有确切的意义,不能有二义性。例如“增加x的值”,并没有说增加多少,计算机就无法执行明确的运算。 _算法

【网络安全】网络安全的标准和规范_网络安全标准规范-程序员宅基地

文章浏览阅读1.5k次,点赞18次,收藏26次。网络安全的标准和规范是网络安全领域的重要组成部分。它们为网络安全提供了技术依据,规定了网络安全的技术要求和操作方式,帮助我们构建安全的网络环境。下面,我们将详细介绍一些主要的网络安全标准和规范,以及它们在实际操作中的应用。_网络安全标准规范