ZCMU训练赛-A(模拟)
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 Selection, Old 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(模拟)的更多相关文章
- ZCMU训练赛-H(模拟)
H - Hard to Play MightyHorse is playing a music game called osu!. After playing for several months ...
- ZCMU训练赛-J(循环节+字符串处理)
J - Java Beans There are N little kids sitting in a circle, each of them are carrying some java bean ...
- ZCMU训练赛-B(dp/暴力)
B - Break Standard Weight The balance was the first mass measuring instrument invented. In its tradi ...
- Contest1592 - 2018-2019赛季多校联合新生训练赛第二场(部分题解)
Contest1592 - 2018-2019赛季多校联合新生训练赛第二场 D 10248 修建高楼(模拟优化) H 10252 组装玩具(贪心+二分) D 传送门 题干 题目描述 C 市有一条东西走 ...
- 10.0.0.55_12-16训练赛部分writeup
0x1 - MISC MISC100 一张帅行的照片 目测是图片隐写,但是binwalk并没有出来,应该是对文件头进行了修改 010editor查看一下,发现在jpg文件尾之后还有大量的数据 而且在灰 ...
- Contest1585 - 2018-2019赛季多校联合新生训练赛第一场(部分题解)
Contest1585 - 2018-2019赛季多校联合新生训练赛第一场 C 10187 查找特定的合数 D 10188 传话游戏 H 10192 扫雷游戏 C 传送门 题干: 题目描述 自然数中除 ...
- 7.30 正睿暑期集训营 A班训练赛
目录 2018.7.30 正睿暑期集训营 A班训练赛 T1 A.蔡老板分果子(Hash) T2 B.蔡老板送外卖(并查集 最小生成树) T3 C.蔡老板学数学(DP NTT) 考试代码 T2 T3 2 ...
- HDU6578 2019HDU多校训练赛第一场 1001 (dp)
HDU6578 2019HDU多校训练赛第一场 1001 (dp) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6578 题意: 你有n个空需要去填,有 ...
- HDU6579 2019HDU多校训练赛第一场1002 (线性基)
HDU6579 2019HDU多校训练赛第一场1002 (线性基) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6579 题意: 两种操作 1.在序列末 ...
随机推荐
- 对C++ templates类模板的几点补充(Traits类模板特化)
前一篇文章<浅谈C++ templates 函数模板.类模板以及非类型模板参数>简单的介绍了什么是函数模板(这个最简单),类模板以及非类型模板参数.本文对类模板再做几点补充. 文章目录1. ...
- cdq分治入门学习 cogs 1752 Mokia nwerc 2015-2016 G 二维偏序
/* CDQ分治的对象是时间. 即对于一个时间段[L, R],我们取mid = (L + R) / 2. 分治的每层只考虑mid之前的修改对mid之后的查询的贡献,然后递归到[L,mid],(mid, ...
- vue中使用 echarts3.0 或 echarts2.0 (模拟迁徙图,折线图)
一.echarts3.0(官网: http://echarts.baidu.com/) 首先通过npm安装echarts依赖,安装的为3.0版本 npm install echarts -s 也可以使 ...
- codevs 1191 线段树 区间更新(水)
题目描述 Description 在一条数轴上有N个点,分别是1-N.一开始所有的点都被染成黑色.接着我们进行M次操作,第i次操作将[Li,Ri]这些点染成白色.请输出每个操作执行后剩余黑色点的个数. ...
- json获取属性值的方式
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.易于人阅读和编写.同时也易于机器解析和生成.它基于JavaScript(Standard ECMA-262 ...
- oracle的group by问题
ORA-00979 不是 GROUP BY 表达式”这个错误,和我前面介绍的另外一个错误ORA-00937一样使很多初学oracle的人爱犯的. 我在介绍使用聚合函数中用group by来分组数据时特 ...
- 如何取消PPT中的动画效果
幻灯片放映——>设置放映式——>勾选放映时不加动画 (office2007)
- java过滤器和监听器详解
过滤器 1.Filter工作原理(执行流程) 当客户端发出Web资源的请求时,Web服务器根据应用程序配置文件设置的过滤规则进行检查,若客户请求满足过滤规则,则对客户请求/响应进行拦截,对请求头和请求 ...
- tr/td
在HTML中,tr代表行,td代表列. 说明: 1.tr与td必须一起使用,并且输入的内容必须在td里面: 2.td必须在tr里面,表示在一行中的列: 3.在一个tr里面,有x个td,就表示在这一行里 ...
- idea控制台中文乱码问题解决办法
解决办法: 打开Intellij的安装的bin目录(D:\Program Files\JetBrains\IntelliJ IDEA 14.0\bin ),找到上图的两个文件(根据你的系统是32位或6 ...