The Olympic Games are over and now you need to rank the teams. You must pick three integers Pg, Ps and Pb, representing the number of points awarded to each team for each gold, silver and bronze medal they won, respectively, where 1000 >= Pg >= Ps >= Pb >= 1. The teams will be ranked according to the total number of points they have (teams with more points will be ranked higher). You want to select Pg, Ps and Pb so that your team gets ranked as high as possible.
You will be given a String[] teams, the i-th element of which represents the medal counts of the i-th team. Each element will be formatted as "G S B" (quotes for clarity), where G, S and B are integers representing the total number of gold, silver and bronze medals won by that team, respectively. Your team is the 0-th team. The highest possible rank is 1, the second highest rank is 2, and so on. If your team has the same number of total points as some other teams, your team will be ranked higher than those other teams. In other words, your final ranking will be equal to 1 plus the number of teams that have a strictly greater number of points than your team.
Return a int[] containing exactly three elements - the values of Pg, Ps and Pb (in that order) that will give your team the highest ranking. If there are multiple possible return values, return the one with the smallest value for Pg. If there are still multiple return values, return the one with the smallest value for Ps. If there are still multiple return values, return the one with the smallest value for Pb.
|