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 in Marjar 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

题意:这题题目很长,条件也非常多,导致我们比赛的时候少看了一个条件,一直纠结了很久

第一行给出一个数字,代表样例的个数

第二行给出两个数,代表人数和输出排名的前几个人

第三四行分别给出MaoMao Selection和Surgeon Contest的题目数量与题号

第五行给出拿到前三等奖的数目,接下来给出每个获奖的队伍和获得的排名

最后给出每个人的信息,包括人名,队名,性别,OJ里的做题数,参加比赛的数目

然后给出题号与比赛的得分

而每个人的得分计算是这样:

首先是做的题所得的分:1.在MaoMao Selection做的题得2.5分

                    2.在Surgeon Contest做的题得1.5分

3.如果不在这两个地方做的题并且题号为奇数,得1分

4.否则0.3分

如果所在的队伍得奖了:一等奖36分,尔等27,三等18

如果是女的:得到33分

如果参加过比赛,则取排第三的分数,计算公式Pts = max(0, (r - 1200) / 100) * 1.5为得分,如果小于3次比赛则不算

知道了题意之后,就是简单的模拟题了

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std; struct TEAM
{
char name[50];
int rank;
} team[505]; struct MAN
{
char name[30],team[30];
char sex[3];
double score;
int pro,rush;
int p[505],r[505];
} man[505]; int mao[505],sur[505],k_mao,k_sur; int prime(int x)
{
int i;
for(i = 2; i*i<=x; i++)
if(x%i==0)
return 1;
} double problem(int x)
{
int i;
for(i = 0; i<k_mao; i++)
{
if(x == mao[i])
return 2.5;
}
for(i = 0; i<k_sur; i++)
{
if(x == sur[i])
;
return 1.5;
}
if(prime(x))
return 1;
return 0.3;
} int cmp_rank(TEAM x,TEAM y)
{
return x.rank<y.rank;
} double big(double a,double b)
{
return a>b?a:b;
} int cmp_score(MAN x,MAN y)
{
return x.score>y.score;
} int cmp_r(double a,double b)
{
return a>b;
} int main()
{
int t,man_num,team_num,m,i,j,k,xx;
double ss,r[1005];
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&man_num,&m);
scanf("%d",&k_mao);
for(i = 0; i<k_mao; i++)
scanf("%d",&mao[i]);
scanf("%d",&k_sur);
for(i = 0; i<k_sur; i++)
scanf("%d",&sur[i]);
scanf("%d",&team_num);
for(i = 0; i<team_num; i++)
scanf("%s%d",team[i].name,&team[i].rank);
for(i = 0; i<man_num; i++)
{
man[i].score = 0;
scanf("%s%s%s%d%d",man[i].name,man[i].team,man[i].sex,&man[i].pro,&man[i].rush); for(j = 0; j<man[i].pro; j++)
{
scanf("%d",&xx);
man[i].score+=problem(xx);
}
sort(team,team+team_num,cmp_rank);
for(j = 0; j<team_num; j++)
{
if(!strcmp(man[i].team,team[j].name))
{
if(team[j].rank==1)
man[i].score+=36;
else if(team[j].rank==2)
man[i].score+=27;
else if(team[j].rank==3)
man[i].score+=18;
}
}
memset(r,0,sizeof(r));
for(j = 0; j<man[i].rush; j++)
{
scanf("%lf",&r[j]);
}
sort(r,r+man[i].rush,cmp_r);
if(man[i].rush>=3)
man[i].score+=big(0,((r[2]-1200.0)/100)*1.5);
if(!strcmp(man[i].sex,"F"))
man[i].score+=33;
}
sort(man,man+man_num,cmp_score);
for(i = 0; i<m; i++)
{
printf("%s %.3lf\n",man[i].name,man[i].score);
}
}
return 0;
}

ZOJ3705:Applications的更多相关文章

  1. Authorization in Cloud Applications using AD Groups

    If you're a developer of a SaaS application that allows business users to create and share content – ...

  2. DAC Usage3:Monitor Data-tier Applications

    If you deploy a DAC to a managed instance of the Database Engine, information about the deployed DAC ...

  3. Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications 云设计模式:云应用的规范架构指导

    1.Cache-aside Pattern 缓存模式 Load data on demand into a cache from a data store. This pattern can impr ...

  4. Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibr

    网上找了一大堆,没有解决的办法 ,主要是iOS10的适配问题,info.plist里没有加对. 访问相册,我只加了 <!-- 相册 --> <key>NSPhotoLibrar ...

  5. Identify Memory Leaks in Visual CPP Applications —— VLD内存泄漏检测工具

    原文地址:http://www.codeproject.com/Articles/1045847/Identify-Memory-Leaks-in-Visual-CPP-Applications 基于 ...

  6. CLR via C# 3rd - 02 - Building, Packaging, Deploying, and Administering Applications and Types

    1. C# Compiler - CSC.exe            csc.exe /out:Program.exe /t:exe /r:MSCorLib.dll Program.cs       ...

  7. [转]Amazon DynamoDB – a Fast and Scalable NoSQL Database Service Designed for Internet Scale Applications

    This article is from blog of Amazon CTO Werner Vogels. -------------------- Today is a very exciting ...

  8. 我看见的第一个XCODE编译错误 - Command /applications.../clang failed with exit code 1

    开始用XCODE学习Apple相关开发的东东,写些demo熟悉Object C,一直还没看见什么问题,昨晚在家把一些demo上传到代码服务器,今天在另外一台机器上下载下来编译,出现了问题: Preco ...

  9. Kernel Functions for Machine Learning Applications

    In recent years, Kernel methods have received major attention, particularly due to the increased pop ...

随机推荐

  1. How To Move a MySQL Data Directory to a New Location on Ubuntu 16.04

    16 How To Move a MySQL Data Directory to a New Location on Ubuntu 16.04 PostedJuly 21, 2016 62.1kvie ...

  2. Python 小知识点(6)--静态方法、类方法、属性方法

    (1)静态方法-->-@staticmethod装饰类中方法 只是名义上归类管理, 实际上在静态方法里访问不了类或实例中的任何属性 class Dog(object): def __init__ ...

  3. STL之父Stepanov谈泛型编程的发展史

    这是一篇Dr. Dobb's Journal对STL之父stepanov的采访.文中数次提到STL的基本思想.语言的特性.编程的一些根本问题等,非常精彩.这篇文章让我想去拜读下stepanov的大作& ...

  4. 在Android Studio 0.5.2中使用ArcGIS Android SDK

    环境 操作系统:Mac OSX 10.8.5Android Studio: 0.5.2ArcGIS Android SDK: 10.2.3 操作步骤 在Android Studio中新建一个Modul ...

  5. [转载]用 FFMPEG 合并 MP4 视频

    因为 ffmpeg 是支持切分 mp4 视频的,所以我就理所当然的以为 ffmpeg 是支持视频合并.直到今天同事找我问方法,才发现一直以为的方法是错误的, mp4 不支持直接 concate(丢人了 ...

  6. ADDCOMPONENT之后立即(同步)调用AWAKE,但START却是所有AWAKE完成后才调用 的(异步)

    addcomponent 等价于 instance了一个组件,完成后立即从该点调用awake(). 等到游戏中所有组件都被awake()之后,start()才会被调用.示例如下: class MyTe ...

  7. Linux实战教学笔记44:NoSQL数据库开篇之应用指南

    第1章 NoSQL数据库 1.1 NoSQL概述 自关系型数据库诞生40年以来,从理论产生发展到现实产品,例如:大家最常见的MySQL和Oracle,逐渐在数据库领域里上升到了霸主地位,形成每年高达数 ...

  8. PencilWang博客目录

    在这里有一坨目录,以后自己和别人看随笔都会方便很多 一 .刷题相关 1.BZOJ BZOJ1001(最大流,最短路)(EASY+)   BZOJ1002(数学)(NORMAL+)  BZOJ1003( ...

  9. IDEA04 工具窗口管理、各种跳转、高效定位、行操作、列操作、live template、postfix、alt enter、重构、git使用

    1 工具窗口管理 所有的窗口都是在view -> tools windows 下面的,这些窗口可以放在IDEA的上下左右各个位置:右键某个窗口后选择move to 即可进行位置调整 2 跳转 2 ...

  10. PHP获取当前文件路径

    __FILE__ 是当前路径+文件名dirname(__FILE__)返回当前文件路径的路径部分 例如当前文件是 /home/data/demo/demo.php ,则 __FILE__ 得到的就是完 ...