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

智能推荐

微信小程序源码案例大全_微信小程序switch页面demo-程序员宅基地

文章浏览阅读4.3k次,点赞4次,收藏62次。微信小程序demo:足球,赛事分析 小程序简易导航 小程序demo:办公审批 小程序Demo:电魔方 小程序demo:借阅伴侣 微信小程序demo:投票 微信小程序demo:健康生活 小程序demo:文章列表demo 微商城(含微信小程序)完整源码+配置指南 微信小程序Demo:一个简单的工作系统 微信小程序Demo:用于聚会的小程序 微信小程序Demo:Growth 是一款..._微信小程序switch页面demo

SLAM学习笔记(Code2)----刚体运动、Eigen库_eigen.determinant-程序员宅基地

文章浏览阅读2.2k次。2.1除了#include<iostream>之外的头文件#include <Eigen/Core>//Core:核心#include <Eigen/Dense>//求矩阵的逆、特征值、行列式等#include <Eigen/Geometry>//Eigen的几何模块,可以利用矩阵完成如旋转、平移/***其他***/#include <ctime>//可用于计时,比较哪个程序更快#include <cmath>//包含a_eigen.determinant

图像梯度-sobel算子-程序员宅基地

文章浏览阅读1w次,点赞12次,收藏61次。(1)理论部分x 水平方向的梯度, 其实也就是右边 - 左边,有的权重为1,有的为2 。若是计算出来的值很大 说明是一个边界 。y 竖直方向的梯度,其实也就是下面减上面,权重1,或2 。若是计算出来的值很大 说明是一个边界 。图像的梯度为:有时简化为:即:(2)程序部分函数:Sobelddepth 通常取 -1,但是会导致结果溢出,检测不出边缘,故使..._sobel算子

cuda10.1和cudnn7.6.5百度网盘下载链接(Linux版)_cudnn7.6网盘下载-程序员宅基地

文章浏览阅读3.6k次,点赞17次,收藏8次。cuda10.1和cudnn7.6.5百度网盘下载链接(Linux版)在官网下载不仅慢,,,主要是还总失败。。终于下载成功了,这里给出百度网盘下载链接,希望可以帮到别人百度网盘下载链接提取码: vyg5_cudnn7.6网盘下载

Python正则表达式大全-程序员宅基地

文章浏览阅读9.3w次,点赞69次,收藏427次。定义:正则表达式是对字符串(包括普通字符(例如,a 到 z 之间的字母)和特殊字符(称为“元字符”))操作的一种逻辑公式,就是用事先定义好的一些特定字符、及这些特定字符的组合,组成一个“规则字符串”,这个“规则字符串”用来表达对字符串的一种过滤逻辑。正则表达式是一种文本模式,该模式描述在搜索文本时要匹配的一个或多个字符串。上面都是官方的说明,我自己的理解是(仅供参考):通过事先规定好一些特殊字符的匹配规则,然后利用这些字符进行组合来匹配各种复杂的字符串场景。比如现在的爬虫和数据分析,字符串校验等等都需要用_python正则表达式

Vue之条件渲染_条件渲染的基本概念-程序员宅基地

文章浏览阅读973次。条件渲染就是在指定的条件下,渲染出指定的UI。比如当我们显示主页的时候,应该隐藏掉登录等一系列不相干的UI元素。即UI元素只在特定条件下进行显示。而在VUE3中,这种UI元素的显示和隐藏可以通过两个关键字,`v-if` 和`v-show`来实现。但是虽然实现的功能一样,但他们两者有着一些细微的区别。总结起来这个区别就是:v-show控制UI元素隐藏时只是将UI的显示状态变成了不可见,实际上这个UI是存在的,但是v-if隐藏UI元素时则是直接干掉了这个UI元素,使其不显示_条件渲染的基本概念

随便推点

NILM(非侵入式电力负荷监测)学习笔记 —— 准备工作(一)配置环境NILMTK Toolkit_nilmtk学习-程序员宅基地

文章浏览阅读1.9w次,点赞27次,收藏122次。安装Anaconda,Python,pycharm我另一篇文章里面有介绍https://blog.csdn.net/wwb1990/article/details/103883775安装NILMTK有了上面的环境,接下来进入正题。NILMTK官网:http://nilmtk.github.io/因为官方安装流程是基于linux的(官方安装流程),我这里提供windows..._nilmtk学习

k8s-pod 控制器-程序员宅基地

文章浏览阅读826次,点赞20次,收藏28次。如果实际 Pod 数量比指定的多那就结束掉多余的,如果实际数量比指定的少就新启动一些Pod,当 Pod 失败、被删除或者挂掉后,RC 都会去自动创建新的 Pod 来保证副本数量,所以即使只有一个 Pod,我们也应该使用 RC 来管理我们的 Pod。label 与 selector 配合,可以实现对象的“关联”,“Pod 控制器” 与 Pod 是相关联的 —— “Pod 控制器”依赖于 Pod,可以给 Pod 设置 label,然后给“控制器”设置对应的 selector,这就实现了对象的关联。

相关工具设置-程序员宅基地

文章浏览阅读57次。1. ultraEdit设置禁止自动更新: 菜单栏:高级->配置->应用程序布局->其他 取消勾选“自动检查更新”2.xshell 传输文件中设置编码,防止乱码: 文件 -- 属性 -- 选项 -- 连接 -- 使用UTF-8编码3.乱码修改:修改tomcat下配置中,修改: <Connector connectionTimeou..._高级-配置-应用程序布局

ico引入方法_arco的ico怎么导入-程序员宅基地

文章浏览阅读1.2k次。打开下面的网站后,挑选要使用的,https://icomoon.io/app/#/select/image下载后 解压 ,先把fonts里面的文件复制到项目fonts文件夹中去,然后打开其中的style.css文件找到类似下面的代码@font-face {font-family: ‘icomoon’;src: url(’…/fonts/icomoon.eot?r069d6’);s..._arco的ico怎么导入

Microsoft Visual Studio 2010(VS2010)正式版 CDKEY_visual_studio_2010_professional key-程序员宅基地

文章浏览阅读1.9k次。Microsoft Visual Studio 2010(VS2010)正式版 CDKEY / SN:YCFHQ-9DWCY-DKV88-T2TMH-G7BHP企业版、旗舰版都适用推荐直接下载电驴资源的vs旗舰版然后安装,好用方便且省时!) MSDN VS2010 Ultimate 简体中文正式旗舰版破解版下载(附序列号) visual studio 2010正_visual_studio_2010_professional key

互联网医疗的定义及架构-程序员宅基地

文章浏览阅读3.2k次,点赞2次,收藏17次。导读:互联网医疗是指综合利用大数据、云计算等信息技术使得传统医疗产业与互联网、物联网、人工智能等技术应用紧密集合,形成诊前咨询、诊中诊疗、诊后康复保健、慢性病管理、健康预防等大健康生态深度..._线上医疗的定义

推荐文章

热门文章

相关标签