# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13465 | max/min in assigned area |
|
13473 | Scoreboard Parsing (cheat) |
|
Description
Given a list of numbers, an some indicators,
you need to find out the maximum or minimum number in the list according to the indicators.
Input
There is only one line in the input, which contains the list of numbers and some indicators.
An example is shown below.
9,0,21,i1,61,66,f5,91,62,22,22
Note that
- The red element in the line is an indicator where you can find it start with the character "i" and followed by a digit. (1 in this example). When you meet "i1", you need to find the maximum; and "i2" to find the minimum.
- The green element in the line is also an indicator. It starts from either "f" or "b" and followed by a number k. ("f5" in this example). The character "f" stands for "front". It means you need to find the answer from the first k numbers. The character "b" stands for "back". It means you need to find the answer from the last k numbers. In this case, "f5" means you need to find the answer from the first 5 numbers. When there is no this kind of indicator, you need to find the answer from all the numbers. ( Please note that there would be only one indicator like this. )
- The remaining blue elements are the numbers of the list of numbers.
- You need to consider some edge cases, such as
4.1. If the blue elements are the same number, the input can sometimes only give i1 or i2 without b or f info. This is considered valid input.
4.2. If the number behind b or f is 0, such as b0, it is considered an empty range. The input is considered non-valid input.
4.3 If the input without i indicator. The input is consider non-valid input - If the input is not valid, print "None" instead.
Output
The output is a line of text with the maximum/minimum number from the list.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Calculate the score of students from the NTHU OJ scoreboard based on how many test cases a student has passed.
This is a continued problem from Problem 13849. (https://acm.cs.nthu.edu.tw/problem/13849/)
In this problem, we are going to handle the situation that there are some users who cheat on certain problems.
Input
The input consists of three parts as demonstrated below.
0.5 0.25 0.25
1,106095014,3/3,1/1,1/1,5
2,106095029,3/3,1/1,0/1,5,d1,d3
3,GEC2_105072127,1/3,1/1,0/1,5,d1X014
X2127
- The first line (highlighted in yellow) is the weights for each problem in the contest where you need to apply the "weighted average" to calculate the final score for each user.
- The second part is the lines highlighted in green background. Each line describes the answering record for the given user and there could be more than 3 lines in this part.
The syntax of each line is explained by this example:
2,106095029,3/3,1/1,0/1,5,d1,d3
where you can ignore the rank and calculate the weighted average for each problem according to the weights provided in the 1st line. The formula of the weighted sum is provided below.Rank, User, Problem 1 Result, Problem 2 Result, ... , Problem N Result, Total Passed Cases, ignored answers, ...
where w denotes the weight and x denotes the score for each problem.
For the ignored answers, it denotes the user who cheated on the specific problem and you need to set the scores of that problem to be "0". For example, we have "d1, d3" which indicates that this user (106095029) cheated on problems 1 and 3. Thus, we need to set the scores for these two problems as 0 and the final score should only accumulate from the remaining problems, i.e. problem 2 in this case.
Note that the weights are not affected by the cheating. It is still 0.5, 0.25, and 0.25 for problem 1, 2, 3, respectively.
Finally, this user only gets 25 points contributed by problem 2, which has a 0.25 weight and obtains a 100 point score.
- The last part is the lines highlighted in red background. These lines indicate the users who cheated for the entire contest and, therefore, their final score should be directly set as 0. (Note that it is optional to have this part.)
In the given example above, the scores for the records that its username ended with 014 or 2127 should be set as 0.
Output
The score for each student of the given contest with the format:
User,Score
Note that
- The order of the output score should follow the same order as the input. That is, you can not ignore any record from the input. E.g. let's say there are 10 input records, you need to output 10 scores corresponding to the input records.
- The score should have 2 decimals.