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.在序列末 ...
随机推荐
- JavaScript选择打开手机网站还是电脑网站
现在手机网站越来越普遍,类似京东.淘宝.新浪等等大家都推出了wap版,一种简单的方法判断,JavaScript选择打开手机网站还是电脑网站,如果是手机网站就让网页跳转到手机网址.如果是电脑网站,打开电 ...
- 【考试记录】4.8 Path (网络流 —— 劲题)
手抄代码 + 学习指针 + 冥思苦想一晚上终于——在一瞬间开窍了.果然题目都是这样:突破了一个点,一切都是柳暗花明. 题面描述: 样例: 这道题目,首先注意到给定的边的性质:这些边在平面上构成了一棵树 ...
- 【BZOJ 3551】[ONTAK2010] Peaks加强版 Kruskal重构树+树上倍增+主席树
这题真刺激...... I.关于Kruskal重构树,我只能开门了,不过补充一下那玩意还是一棵满二叉树.(看一下内容之前请先进门坐一坐) II.原来只是用树上倍增求Lca,但其实树上倍增是一种方法,L ...
- 【NOIP模拟赛】天神下凡 动态开点线段树
这些圆一定是在同一水平面上的,由于他们没有相交,因此我们发现他们每个人与外界关系可以分为,1.存在并圈圈 2.存在圈圈并被割,因此我们把所有的圆都加1,把被割的在加1,就可以啦,因此我们开一个线段树, ...
- [poj 2274]后缀数组+最长公共子串
题目链接:http://poj.org/problem?id=2774 后缀数组真的太强大了,原本dp是O(nm)的复杂度,在这里只需要O(n+m). 做法:将两个串中间夹一个未出现过的字符接起来,然 ...
- BZOJ1191:超级英雄(二分图匹配)
[HNOI2006]超级英雄Hero 题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1191 Description: 现在电视台有一种节 ...
- mysql的对象
mysql 常见的数据对象有哪些: DataBase/Schema Table Index View/Trigger/Function/Procedure 多Database用途: 业务的隔离 ...
- Java多线程调试如何完成信息输出处理
转载自:http://developer.51cto.com/art/201003/189078.htm Java多线程调试是很繁琐的,但是还是需要我们不断进行相关的学习.下面我们就来看看在Java多 ...
- DP---背包问题
http://www.hawstein.com/posts/dp-knapsack.html http://www.cnblogs.com/wwwjieo0/archive/2013/04/01/29 ...
- [USACO07FEB]新牛棚Building A New Barn
洛谷题目链接:[USACO07FEB]新牛棚Building A New Barn 题目描述 After scrimping and saving for years, Farmer John has ...