A - Applications

https://vjudge.net/contest/174208#overview

Recently, the ACM/ICPC team of Marjar Universitydecided 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 Selectionfrom 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 JapanJam,ZacaiForces and so on. The registered member ofJapanJam 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 inJapanJam.

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.

<h4< dd="">Output

For each test case, output M lines, means that Mapplicants 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.

<h4< dd="">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

<h4< dd="">Sample Output

FScarlet 60.000
IamMM 44.300
A 36.000
 #include <iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
#include<cstring>
using namespace std;
const int N = ;
const double eps = 1e-; int maomao[N],old[N];
bool is[];
int n,m,r,s,teamnum;
struct node1
{
char t_name[];
int prize;
}team[N];
struct node2
{
char name[],team[],sex[];
double score;
int p,c;
int solved[],ranks[];
}app[N]; void getprm()
{
int i,j;
memset(is,,sizeof(is));
for(i = ;i <= ;i += )
is[i] = ;
for(i = ;i <= ;i += )
{
if(is[i] == )
{
for(j = i + i;j <= ;j += i)
is[j] = ;
}
}
} int ismaomao(int x)
{
int i;
for(i = ;i < r;i ++)
if(maomao[i] == x)
return ;
return ;
} int isold(int x)
{
int i;
for(i = ;i < s;i ++)
if(old[i] == x)
return ;
return ;
} int isprime(int x)
{
int i;
for(i = ;i * i <= x;i ++)
if(x % i == )
return ;
return ;
} int cmp(struct node2 a,struct node2 b)
{
if(fabs(a.score - b.score) < eps)
return strcmp(a.name,b.name) < ;
else
return a.score > b.score;
} int teamprize(int id)
{
int i;
for(i = ;i < teamnum;i ++)
{
if(strcmp(app[id].team,team[i].t_name) == )
return team[i].prize;
}
return ;
} int main()
{
getprm();
int t;
int i,j;
scanf("%d",&t);
while(t --)
{
scanf("%d%d",&n,&m);
scanf("%d",&r);
for(i = ;i < r;i ++)
scanf("%d",&maomao[i]);
sort(maomao,maomao + r);
scanf("%d",&s);
for(i = ;i < s;i ++)
scanf("%d",&old[i]);
sort(old,old + s);
scanf("%d",&teamnum);
for(i = ;i < teamnum;i ++)
{
scanf("%s%d",team[i].t_name,&team[i].prize);
}
for(i = ;i < n;i ++)
{
scanf("%s%s%s%d%d",app[i].name,app[i].team,app[i].sex,&app[i].p,&app[i].c);
if(app[i].sex[] == 'F')
app[i].score = ;
else
app[i].score = ;
for(j = ;j < app[i].p;j ++)
{
scanf("%d",&app[i].solved[j]);
if(ismaomao(app[i].solved[j]))
app[i].score = app[i].score + 2.5;
else
{
if(isold(app[i].solved[j]))
app[i].score = app[i].score + 1.5;
else
{
if(isprime(app[i].solved[j]))
app[i].score = app[i].score + ;
else
app[i].score = app[i].score + 0.3;
}
}
}
for(j = ;j < app[i].c;j ++)
scanf("%d",&app[i].ranks[j]);
switch(teamprize(i))
{
case :app[i].score = app[i].score + ;
break;
case :app[i].score = app[i].score + ;
break;
case :app[i].score = app[i].score + ;
break;
default:
break;
}
sort(app[i].ranks,app[i].ranks + app[i].c);
if(app[i].c >= )
{
int tmp = app[i].ranks[app[i].c - ];
double tp = (tmp - ) / 100.0;
tp = tp * 1.5;
if(tp > )
app[i].score = app[i].score + tp;
}
}
sort(app,app + n,cmp);
for(i = ;i < m;i ++)
printf("%s %.3f\n",app[i].name,app[i].score);
}
return ;
}
												

ZCMU训练赛-A(模拟)的更多相关文章

  1. ZCMU训练赛-H(模拟)

    H - Hard to Play   MightyHorse is playing a music game called osu!. After playing for several months ...

  2. ZCMU训练赛-J(循环节+字符串处理)

    J - Java Beans There are N little kids sitting in a circle, each of them are carrying some java bean ...

  3. ZCMU训练赛-B(dp/暴力)

    B - Break Standard Weight The balance was the first mass measuring instrument invented. In its tradi ...

  4. Contest1592 - 2018-2019赛季多校联合新生训练赛第二场(部分题解)

    Contest1592 - 2018-2019赛季多校联合新生训练赛第二场 D 10248 修建高楼(模拟优化) H 10252 组装玩具(贪心+二分) D 传送门 题干 题目描述 C 市有一条东西走 ...

  5. 10.0.0.55_12-16训练赛部分writeup

    0x1 - MISC MISC100 一张帅行的照片 目测是图片隐写,但是binwalk并没有出来,应该是对文件头进行了修改 010editor查看一下,发现在jpg文件尾之后还有大量的数据 而且在灰 ...

  6. Contest1585 - 2018-2019赛季多校联合新生训练赛第一场(部分题解)

    Contest1585 - 2018-2019赛季多校联合新生训练赛第一场 C 10187 查找特定的合数 D 10188 传话游戏 H 10192 扫雷游戏 C 传送门 题干: 题目描述 自然数中除 ...

  7. 7.30 正睿暑期集训营 A班训练赛

    目录 2018.7.30 正睿暑期集训营 A班训练赛 T1 A.蔡老板分果子(Hash) T2 B.蔡老板送外卖(并查集 最小生成树) T3 C.蔡老板学数学(DP NTT) 考试代码 T2 T3 2 ...

  8. HDU6578 2019HDU多校训练赛第一场 1001 (dp)

    HDU6578 2019HDU多校训练赛第一场 1001 (dp) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6578 题意: 你有n个空需要去填,有 ...

  9. HDU6579 2019HDU多校训练赛第一场1002 (线性基)

    HDU6579 2019HDU多校训练赛第一场1002 (线性基) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6579 题意: 两种操作 1.在序列末 ...

随机推荐

  1. 【bzoj2815】[ZJOI2012]灾难 拓扑排序+倍增LCA

    题目描述(转自洛谷) 阿米巴是小强的好朋友. 阿米巴和小强在草原上捉蚂蚱.小强突然想,果蚂蚱被他们捉灭绝了,那么吃蚂蚱的小鸟就会饿死,而捕食小鸟的猛禽也会跟着灭绝,从而引发一系列的生态灾难. 学过生物 ...

  2. BZOJ1607 [Usaco2008 Dec]Patting Heads 轻拍牛头 【筛法】

    题目 今天是贝茜的生日,为了庆祝自己的生日,贝茜邀你来玩一个游戏. 贝茜让N(1≤N≤100000)头奶牛坐成一个圈.除了1号与N号奶牛外,i号奶牛与i-l号和i+l号奶牛相邻.N号奶牛与1号奶牛相邻 ...

  3. 获取本地ip地址 C#

    与ipconfig获取的所有信息一致的方法: private void GetIp() { System.Diagnostics.Process cmdp= new System.Diagnostic ...

  4. display:inline-block带来的问题及解决办法

    在日常工作中,会经常遇到两个或多个元素并排排列的效果,以前会使用float等实现,float虽然方便好用,但是需要清除浮动,有时会带来意想不到的bug 而且在移动端是不推荐使用float的,所以使用d ...

  5. Asp.net MVC Combres的简单用法

    第一步:添加nuget包 [1]添加 nuget包后,会自动在 webconfig里面 添加配置文件(不用改) <section name="dotless" type=&q ...

  6. [lucene系列笔记3]用socket把lucene做成一个web服务

    上一篇介绍了用lucene建立索引和搜索,但是那些都只是在本机上运行的,如果希望在服务器上做成web服务该怎么办呢? 一个有效的方法就是用socket通信,这样可以实现后端与前端的独立,也就是不管前端 ...

  7. shell监控进程是否存在

    1.直接给代码:我这个是两个程序.多半要写成函数 [root@java1 src]# cat checkprocess.sh #!/bin/bashcheckprocess(){ps -ef|grep ...

  8. NET面试题 (四)

    1, 面向对象的思想主要包括什么? 封装.继承.多态. TLW: 封装:用抽象的数据类型将数据和基于数据的操作封装在一起,数据被保护在抽象数据类型内部. 继承:子类拥有父类的所有数据和操作. 多态:一 ...

  9. 51nod 1791 合法括号子段

    有一个括号序列,现在要计算一下它有多少非空子段是合法括号序列. 合法括号序列的定义是: 1.空序列是合法括号序列. 2.如果S是合法括号序列,那么(S)是合法括号序列.3.如果A和B都是合法括号序列, ...

  10. [bzoj3994][SDOI2015]约数个数和-数论

    Brief Description 计算\(\sum_{i\leqslant n}\sum_{j\leqslant m}\sigma_0(ij)\). Algorithm Design 首先证明一个结 ...