|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||2||0||0||0.000%|
Every year since 1896, the nations of the world have competed in the Olympic Games for glory, medals and (particularly in recent years) media coverage. Every day eager fans will scan the medal table to see where their team is placed, which, particularly for teams from smaller countries, usually means badly. Part of the problem is that the medal table is sorted strictly in the order: number of gold medals, number of silvers, number of bronzes. This means that a team with 6 silvers and 10 bronzes but only 1 gold is placed well behind a team with 2 golds and nothing else. The situation could be alleviated by allocating a value to each medal type, calculating a total score for each team by multiplying the numbers of each medal type they have won by the appropriate value and then ranking the teams on that. This then raises the problem of determining the values, with the obvious proviso that a gold has to be worth more than a silver which, in turn, has to worth more than a bronze. To keep numbers manageable (remember we are dealing with the general population, not Computer Science students), values must be in the range 1 to 99.
For this problem you will be given a medal table, that is, a list of countries together with the numbers of medals they have won, from which your program is to determine, for each country in the table, what allocation of values to medal types will give that country the best possible placing, where the placing of a country is the number of rivals with a larger score, plus 1.
Input will consist of several scenarios (Games). Each will start with the name of the city where the Games were held, followed by an unsorted sequence of lines containing the name of a country followed by 3 integers representing the number of gold, silver, and bronze medals won by that country, and terminated by a line containing a single ‘#’. There will be no more than 100 teams in any one Games and no team will win more than 1000 medals. The sequence of Games will be terminated by a line consisting of only a single ‘#’.
Output (for each scenario) will consist of a header line followed by a line for each team in the input in the order they appeared in the input. The header line will consist of ‘Olympic Games in ’ followed by the name of the relevant city. Each team line will consist of the name of the team followed by 4 integers, separated by single spaces, giving the medal values that results in their highest placing, and that placing. Remember that the values must be such that gold > silver > bronze and that they must be in the range 1 to 99. If there are several allocations of values that produce the same best placing, then choose the one that produces the smallest 6 digit number ggssbb, where gg, ss, and bb are the relevant values (including leading zeroes if necessary). Leave a single blank line between scenarios (Games).
Rome UnitedStates 100 200 300 China 102 198 297 NewZealand 1 2 3 # Auckland UnitedStates 100 200 300 China 102 198 301 NewZealand 1 2 3 # #
Olympic Games in Rome UnitedStates 3 2 1 1 China 4 2 1 1 NewZealand 3 2 1 3 Olympic Games in Auckland UnitedStates 3 2 1 2 China 3 2 1 1 NewZealand 3 2 1 3