• ZOJ 3705 Applications


    Applications

    Time Limit: 2 Seconds      Memory Limit: 65536 KB

    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 JapanJam, ZacaiForces 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 ≤ MN) - 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 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.

    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



    模拟题

     1 #include <iostream>
     2 #include <cstdio>
     3 #include <string>
     4 #include <set>
     5 #include <algorithm>
     6 #include <iomanip>
     7 using namespace std;
     8 
     9 set<int> setM, setO;
    10 struct Teams{
    11     string name;
    12     int pr;
    13 }team[550];
    14 
    15 typedef struct Applicants{
    16     string name;
    17     double pts;
    18 }A;
    19 A app[550];
    20 
    21 bool cmp(const A &a, const A &b)
    22 {
    23     return (a.pts == b.pts ? a.name<b.name : a.pts>b.pts);
    24 }
    25 bool is_prime(int n)
    26 {
    27     for (int i = 2; i*i <= n; i++){
    28         if (n % i == 0) return false;
    29     }
    30     return n != 1;
    31 }
    32 
    33 int jc[1005];
    34 
    35 int main()
    36 {
    37     int ca, n, m, r, s, q, p, c, num;
    38     string str;
    39     scanf("%d", &ca);
    40     while (ca--)
    41     {
    42         scanf("%d%d%d", &n, &m, &r);
    43         for (int i = 0; i<r; i++){
    44             scanf("%d", &num);
    45             setM.insert(num);
    46         }
    47         scanf("%d", &s);
    48         for (int i = 0; i<s; i++){
    49             scanf("%d", &num);
    50             setO.insert(num);
    51         }
    52         scanf("%d", &q);
    53         for (int i = 0; i<q; i++)
    54             cin >> team[i].name >> team[i].pr;
    55         for (int i = 0; i<n; i++)
    56         {
    57             double pts = 0;
    58             cin >> app[i].name >> str;
    59             for (int j = 0; j < q; j++){
    60                 if (str == team[j].name){
    61                     if (team[j].pr)
    62                         pts += (36 - (team[j].pr - 1) * 9);
    63                 }
    64             }
    65             cin >> str;
    66             if (str == "F") pts += 33;
    67             scanf("%d%d", &p, &c);
    68             for (int j = 0; j<p; j++){
    69                 scanf("%d", &num);
    70                 if (setM.count(num))
    71                     pts += 2.5;
    72                 else if (setO.count(num))
    73                     pts += 1.5;
    74                 else if (is_prime(num))
    75                     pts += 1;
    76                 else pts += 0.3;
    77             }
    78 
    79             for (int j = 0; j<c; j++)
    80                 scanf("%d", &jc[j]);
    81             sort(jc, jc + c);
    82             double rating=0;
    83             if (c < 3&&jc[0]>1200){
    84                 rating = jc[0];
    85             }
    86             else if (c >= 3 && jc[c - 3] > 1200){
    87                 rating = jc[c - 3];
    88             }
    89             if (jc[c-3] > 1200)
    90                 pts += (rating - 1200) / 100 * 1.5;
    91             app[i].pts = pts;
    92         }
    93 
    94         sort(app, app + n, cmp);
    95         for (int j = 0; j<m; j++)
    96             cout << app[j].name << " " <<fixed<< setprecision(3) << app[j].pts << endl;
    97         setM.clear(); setO.clear();
    98     }
    99 }
  • 相关阅读:
    Super Mario
    SPOJ Count on a tree
    SPOJ DQUERY
    51nod 区间中第K大的数
    POJ2104 K-th Number
    矩阵模板
    Sasha and Array
    MVC RenderSection
    Lazy Acquisition
    .net4.5 await async 简化之后的异步编程模型
  • 原文地址:https://www.cnblogs.com/cumulonimbus/p/5465827.html
Copyright © 2020-2023  润新知