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.在序列末 ...
随机推荐
- CF115B Lawnmower
题目描述 You have a garden consisting entirely of grass and weeds. Your garden is described by an n×mn×m ...
- Codeforces Round #391 div1 757F (Dominator Tree)
首先先膜杜教orz 这里简单说一下支配树的概念 支配树是对一个有向图来讲的 规定一个起点s,如果s到v的路径上必须经过某些点u,那么离s最近的点u就是v的支配点 在树上的关系就是,v的父亲是u. 一般 ...
- [CF1077C]Good Array
题目大意:一个序列是好的当且仅当有一个数是其它所有数的和,问一个序列可以删掉哪个数变成好的序列.输出所有方案. 题解:发现等于其他数的和的那个数一定是其中最大的,只要排序一下(其实只要找到最大的两个数 ...
- 线程 packaged_task future
http://www.cnblogs.com/haippy/p/3279565.html #include <iostream> // std::cout #include <fut ...
- JavaScript创建对象时常用的设计模式
转自:http://www.cnblogs.com/shouce/p/5488101.html 一.工厂模式 function person (name,age) { var p=new Object ...
- 使用jQuery发送POST,Ajax请求返回JSON格式数据
问题: 使用jQuery POST提交数据到PHP文件, PHP返回的json_encode后的数组数据,但jQuery接收到的数据不能解析为JSON对象,而是字符串{"code" ...
- Lucene4.6查询时完全跳过打分,提高查询效率的实现方式
由于索引的文件量比较大,而且应用中不需要对文档进行打分,只需要查询出所有满足条件的文档.所以需要跳过打分来提高查询效率.一开始想用ConstantScoreQuery,但是测试发现这个类虽然让所有返回 ...
- windows支持applocker的版本
Operating system requirements The following table show the on which operating systems AppLocker fe ...
- Java内存区域与内存异常
参考:深入理解Java虚拟机 周志明 方法区 虚拟机战 本地方法栈 堆 程序计数器 其他 设置 方法区 线程共享,加载类信息.常量.静态变量.JIT后的代码,别名Non-Heap 对于HotSpot, ...
- Selenium菜鸟手册
转自: http://www.iselenium.com/read.php?tid=458 首先声明我还是一只很菜的菜鸟,学习Selenium一个来月而已,发这个帖子是想利用我这块板砖引出真正的玉来, ...