#P2116. ACSL 2024-2025 Senior Division Contest #1 Rings

ACSL 2024-2025 Senior Division Contest #1 Rings

PROBLEM DESCRIPTION

ACSL Rings is a game where the object is to score points by tossing a ball through one of the 55 rings. Points are awarded as follows:

  • Through the aqua or red ring 1- 1 point
  • Through the orange or green ring - 33 points
  • Through the black ring 6- 6 points
  • Through the space where 22 rings overlap - the sum of the points for the 22 rings plus 11
  • Any toss that is identified with a + at the end of the substring is awarded 22 extra points for having been tossed from a long distance

We will use a single letter to represent each of the above colors: aqua (A), red (R), orange (O), green (G), and black (B). The overlapping areas will be given by 2 letters: aqua and orange (AO or OA), orange and black (OB or BO), black and green (BG or GB), and green and red (GR or RG).

You will be given an integer, nn (n<=105)(n <= 10^5), indicating the number of players, followed by nn separate strings representing each player’s results for all tosses that go through at least one ring. Output a string for each player’s score in descending order using the format player#-score, each separated by a single space. Ties are broken based on the number of tosses; the fewer the tosses the better. We guarantee that all ties will be broken.

INPUT FORMAT

The input will consist of an integer representing the number of players followed by a string for each player’s results as described above.

OUTPUT FORMAT

Output a string in the format player#-score for each player’s score in descending order, each separated by a single space.

SAMPLE

INPUT #1

3
A R AO+
B+ GR OA B
G OB+

OUTPUT #1

2-24 3-15 1-9

INPUT #2

3
A B R G O
AO OA BO OB GR RG BG GB
A AO B OB R GR B GB

OUTPUT #2

2-60 3-44 1-14

INPUT #3

5
A+ B R+ G O+
AO OB+ GB RG
A AO B R GR G GB O BO
B R A G GR A BG OA R
BG+ B+ G+ OA+ R+ A+ O+

OUTPUT #3

3-44 5-43 4-33 2-32 1-20

INPUT #4

3
A+ R+ AO+ B+ BG+ R+
B+ GR+ AO+ B+
GR+ OB+ R+ AO+ G+ R+

OUTPUT #4

3-37 1-36 2-30

INPUT #5

4
A R+ OA B AO OB BG GR B+
AO OB B+ G BG BG+ GR+
B+ G AO+ OB GR O+ B
B+ B G AO+ AO BG GR G O+ G

OUTPUT #5

2-55 4-55 1-53 3-44

INPUT #6

6
R R G G AO BG GB B
AO GR+ A B AO+ BG BG BO
A A R R G G O O
BG GB GR+ RG O O+ O A+ B
GR RG A+ A O O+ B G
A B+ B O G+ G G AO OB GR BG

OUTPUT #6

6-59 2-56 4-52 1-39 5-31 3-16

EXPLANATION

Sample #1 Explanation

Player 1’s tossess go through the aqua, red, and aqua & orange rings for a score of 1+1+(1+3+1+2)=91 + 1 + (1+3+1+2) = 9.

Player 2 has a score of (6+2)+(3+1+1)+(3+1+1)+6=24(6+2) + (3+1+1) + (3+1+1) + 6 = 24.

Player 3 has a score of 3+(3+6+1+2)=153 + (3+6+1+2) = 15.

Player 2 is in first place with 2424 points; Player 3 is in second place with 1515 points; and Player 1 is in third place with 99 points. The output is the string 2-24 3-15 1-9.