RegularSeason
SRM 207 · 2004-08-10 · by Olexiy
Problem Statement
You will be given a
The return value should be a
Notes
- If a team has a probability of p that it will win a particular game, then that game contributes p/100 to the expected number of games the team will win. However, it is advisable that you wait to divide by 100 until you have completed the summation of the expected number of wins (in order to avoid problems with floating point precision).
Constraints
- teams will contain between 2 and 20 elements, inclusive.
- No element of teams will contain more than 50 characters.
- Each element of teams will be formatted as "NAME P1 P2 ... Pn".
- Each NAME will contain only uppercase letters ('A'-'Z').
- P1, P2, ..., Pn will each be an integer between 0 and 100, inclusive, with no extra leading zeros.
- The ith probability of the ith element of teams will be 0.
- rounds will be between 1 and 10, inclusive.
- No two elements of teams will have the same NAME.
{"A 0 10 50",
"B 100 0 100",
"C 50 10 0"}
5
Returns: { "B 19", "A 6", "C 6" }
Teams A and C are each expected to win half of their games against the other. A and C will both lose all their road games against team B. They are both expected to win 0.5 home games against B (0.1 * 5). Summarizing and rounding 0.5 up will give us the result: B - 19 wins. A - 6 wins. C - 6 wins. Be aware of rounding AFTER calculating the summary for each team. Also, the sum of predictions for all teams may be NOT equal to the sum of games played (there were 30 games played, but teams are predicted to have 31 wins after the rounding).
{"SPURS 0 33 67 100",
"LAKERS 67 0 33 100",
"WOLVES 33 67 0 100",
"KINGS 0 75 75 0"}
2
Returns: { "SPURS 8", "LAKERS 7", "WOLVES 7", "KINGS 3" }
{"A 0 10 20 30 40 50 60 70 80 90",
"AA 90 0 10 20 30 40 50 60 70 80",
"AAA 80 90 0 10 20 30 40 50 60 70",
"AAAA 70 80 90 0 10 20 30 40 50 60",
"AAAAA 60 70 80 90 0 10 20 30 40 50",
"AAAAAA 50 60 70 80 90 0 10 20 30 40",
"AAAAAAA 40 50 60 70 80 90 0 10 20 30",
"AAAAAAAA 30 40 50 60 70 80 90 0 10 20",
"AAAAAAAAA 20 30 40 50 60 70 80 90 0 10",
"AAAAAAAAAA 10 20 30 40 50 60 70 80 90 0"}
10
Returns: { "A 90", "AA 90", "AAA 90", "AAAA 90", "AAAAA 90", "AAAAAA 90", "AAAAAAA 90", "AAAAAAAA 90", "AAAAAAAAA 90", "AAAAAAAAAA 90" }
Don't forget about alphabetical order.
{"DAAJN 0 56 19 81 59","PPERLJ 48 0 35 90 83","P 75 17 0 86 71","UNHWSYYO 51 30 1 0 9","MG 36 14 16 99 0"}
9
Returns: { "P 52", "PPERLJ 49", "DAAJN 36", "MG 31", "UNHWSYYO 12" }
{"BZRDW 0 78 85 100 100 61 39 26","PEEVMENTK 30 0 84 2 37 9 68 5","ORT 0 92 0 27 27 59 69 84","MDJVANRL 73 48 20 0 75 47 46 95","YX 75 10 60 38 0 74 61 57","IMJWIL 36 15 22 42 81 0 52 99","ZHT 75 34 17 66 49 6 0 70","FTVKNX 50 14 95 14 91 69 30 0"}
1
Returns: { "BZRDW 9", "MDJVANRL 8", "IMJWIL 7", "ORT 7", "ZHT 7", "PEEVMENTK 6", "FTVKNX 6", "YX 6" }
Submissions are judged against all 44 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class RegularSeason with a public method vector<string> finalStandings(vector<string> teams, int rounds) · 44 test cases · 2 s / 256 MB per case