10258.Contest Scoreboard

>> বুধবার, ১৮ নভেম্বর, ২০০৯


Think the contest score boards are wrong? Here's your chance to come up with the right rankings.Contestants are ranked first by the number of problems solved (the more the better), then by decreasing amounts of penalty time. If two or more contestants are tied in both problems solved and penalty time, they are displayed in order of increasing team 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 plus 20 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 line is followed by a blank line, and there is also a blank line between two consecutive inputs.Input consists of a snapshot of the judging queue, containing entries from some or all of contestants 1 through 100 solving problems 1 through 9. Each line of input will consist of three numbers and a letter 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 do not affect scoring.Lines of input are in the order in which submissions were received.
Output:
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.Output will consist of a scoreboard sorted as previously described. Each line of output will 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 are actually participating, display only the contestants that have made a submission.


Sample Input:
5

1 1 20 C
1 1 25 C

1 2 10 I
3 1 11 C
1 2 19 R
1 2 21 C
1 1 25 C

1 2 10 I
3 1 11 C
1 2 19 R
1 2 21 C
1 1 25 C
1 3 20 I
5 1 30 I     
3 2 10 C
4 1 30 I

38 1 0 C
48 1 1 R
83 1 2 E
89 9 3 R
7 5 4 R
68 1 5 U
61 1 6 U
27 1 7 R
21 7 8 R
55 2 9 I
54 1 10 U
69 1 11 C
59 2 12 I
43 3 13 I
7 9 14 R
84 6 15 R
52 8 16 C
32 7 17 C
87 7 18 U
44 1 19 I
87 6 20 I
21 6 21 U
6 4 22 E
44 8 23 I
72 5 24 R
35 1 25 E
57 4 26 E
24 5 27 C
30 3 28 I
85 9 29 I
72 5 30 U
30 7 31 U
8 5 32 R
88 1 33 I
61 2 34 C
35 6 35 R
77 4 36 C
46 8 37 I
21 9 38 E
74 3 39 R
7 4 40 U
25 4 41 R
48 1 42 I
87 1 43 C
84 3 44 U
96 9 45 U
60 5 46 R
75 2 47 I
29 4 48 E
3 7 49 I

1 2 10 I
3 1 11 C
1 2 19 R
1 2 21 C
1 1 25 C
1 3 20 I
1 4 40 I
8 4 50 I
Sample Output:
1 1 20

1 2 66
3 1 11

3 2 21
1 2 66
4 0 0
5 0 0

38 1 0
69 1 11
52 1 16
32 1 17
24 1 27
61 1 34
77 1 36
87 1 43
3 0 0
6 0 0
7 0 0
8 0 0
21 0 0
25 0 0
27 0 0
29 0 0
30 0 0
35 0 0
43 0 0
44 0 0
46 0 0
48 0 0
54 0 0
55 0 0
57 0 0
59 0 0
60 0 0
68 0 0
72 0 0
74 0 0
75 0 0
83 0 0
84 0 0
85 0 0
88 0 0
89 0 0
96 0 0

1 2 66
3 1 11
8 0 0

Hinds:
Big problem is  to take input:
Solution:


gets(str);
if(strlen(str)==0)
                 break;
sscanf(str,”%d %d %d %c”,&tn,&pn,&rt,&ch);


1.       Remember, when a solution is accepted then penalty time is added .otherwise not.
2.       First sort descending order according to total solved problem, if equal , then sort ascending order according to penalty time, if equal ,then sort ascending order according to team number
3.       Same problem can accept twice; take only first time, other is ignored (see first input).
4.       Use structure & use qsort function.
5.       Initialize the data correctly.
6.       The outputs of two consecutive cases will be separated by a blank line.
7.       Last has no newline…Be Careful.

Try owning ….
If can’t, take the code….


DOWNLOAD DOCUMENT FILE :

একটি মন্তব্য পোস্ট করুন

  © Rizoan Toufiq , Copy Right @ 2009

Back to TOP