UVA 10258 Contest Scoreboard

Source: Internet
Author: User

Original question:
Think The contest score boards is wrong? Here's your chance to come up and the right rankings. Contestants is ranked first by the number of problems solved (the most of the better), then by decreasing amounts of penalty Time. If or more contestants is tied in both problems solved and penalty time, they is displayed in order of increasing TE AM numbers.
A problem is considered solved by a contestant if any of the submissions for that problem was judged correct. Penalty time is computed as the number of minutes it took for the first correct submission for a problem to be received PL US minutes for each incorrect submission received prior to the correct solution. Unsolved problems incur no time penalties.
Input
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This was followed by a blank line, and there was also a blank line between the consecutive inputs.
Input consists of a snapshot of the judging queue, containing entries from some or all of contestants 1 through Solvin G problems 1 through 9. Each line of input would consist of three numbers and a in the format
Contestant problem time L where l can be ' C ', ' I ', ' R ', ' U ' or ' E '. These stand for Correct, incorrect, clarification Request, unjudged
and erroneous submission. The last three cases does not affect scoring.
Lines of input is in the order in which submissions were received.
Output
For each test case, the output must follow the description below. The outputs of the consecutive cases would be separated to a blank line.
Output would consist of a scoreboard sorted as previously described. Each line of output would contain a contestant number, the number of problems solved by the contestant and the time penalty Accumulated by the contestant. Since not all of contestants 1-100 is actually participating, display only the contestants that has made a submission.
Sample Input

1

1 2 I
3 1 C
1 2 R
1 2 C
1 1 C

Sample Output
1 2 66

English:
ACM's competition ranking criteria.

From Lucky Cat

Have you ever thought about the design of the programming contest? Now you have an opportunity to understand the correct ranking.

The participants first ranked by solving the problem, the more the better. If the problem is solved by the time (penalty time) to rank, the smaller the better. If the problem is solved and the time of punishment is the same, the number of participants is from small to large row.

A participant is seen to solve a problem because the referee decides that the answer is correct (that is, accept). And the time for each participant is calculated as: the sum of the time of his problems. And someone's problem is that the time of day is calculated as: Someone's question has been judged to be the right moment (unit: minute) plus the number of *20 minutes before the problem was judged wrong. For example, a person's question is answered in the 100th minute and the referee is correct, and he has given 3 wrong answers before this question. So his problem is 100+3*20=160. Please note: The unresolved question is not included in the punishment time, and he has sent several wrong answers to the question. In addition, the penalty time for a problem only counts as the first sentence of the problem is correct. If someone has solved the problem and continues to answer the question, the referee will ignore the answer.

Input

The first column in the input has a positive integer that represents how many of the following tests are available. The content of each test is subject to a record of each and every reference, including the participant's number, the question, the time of the upload (in chronological order), and the result of the referee, presented in the following format:
Contestant Problem Time L

Among them is the contestant (1~100), problem, the title number (1~9), time is the time of the upload (from the beginning of the race), L for the referee results, divided into C, I, R, U, E. c is correct, I is not correct, and the last three do not affect the fractions.

Please refer to sample input for the first column in the input and the first Test, as well as the space between the tests.

Output

Each test is ranked by the method described above, including the number of participants, the number of questions solved, and the time of punishment. Since all the participants in the 1~100 are actually present, it is only necessary to list the participants with the answers.
Please refer to the sample Output for a list of test information.

Sample Input

2

1 2 I
3 1 C
1 2 R
1 2 C
1 1 C

1 2 I
3 1 C
1 2 R
1 2 C
1 1 C
6 1 I
7 1 E
Sample Output

1 2 66
3 1 11

1 2 66
3 1 11
6 0 0
7 0 0

#include <bits/stdc++.h> #pragma warning (disable:4996) using namespace std;
const int inf=9999999;
    struct Node {int pro[10];
    BOOL AC[10];
    int mark;
    int id,num;
            Node () {for (int i=0;i<10;i++) {pro[i]=0;
        Ac[i]=false;
        } mark=0;
        Id=-1;
    num=0;
}

};
Map<int,node> mi;
    int CMP (const node &AMP;A,CONST node &b) {if (a.num!=b.num) return a.num>b.num;
else return a.mark<b.mark;
    } int main () {//Ios::sync_with_stdio (FALSE);
    Char s[101];
    int t;
    scanf ("%d", &t);
    GetChar ();
    GetChar ();
        while (t--) {int a,b,c,k;
        Char D;
        Mi.clear ();
            while (gets (s) &&s[0]) {sscanf (S, "%d%d%d%c", &a,&b,&c,&d);
            Node p;
            P=mi[a];
            P.id=a;
            Mi[a].id=a; if (d== ' R ' | | d== ' U ' | |
         d== ' E ') continue;   if (P.ac[b]) continue;
                if (d== ' C ') {p.ac[b]=1;
                p.mark+=c+p.pro[b]*20;
            p.num++;
            } else p.pro[b]++;
        Mi[a]=p;
        cout<<mi[a].id<< "" <<mi[a].num<< "" <<mi[a].mark<<endl;
        } vector<node> tmp;
        for (auto X:mi) tmp.push_back (X.second);
        Sort (Tmp.begin (), Tmp.end (), CMP);
            for (int i=0;i<tmp.size (); i++) {int id=tmp[i].id,num=tmp[i].num,mark=tmp[i].mark;
        printf ("%d%d%d\n", Id,num,mark);
    } if (t) printf ("\ n");
} return 0;
 }

Answer:
is crazy by the input mode of this problem, direct simulation can be.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.