2018 ACIS REDIS - XXXII Colombian Programming Contest - ACM ICPC 1

A: All-star Three-point Contest Source file name: all.c, all.cpp, all.java, or all.py Author: Rafael Niquefa The three-point shooting contest is an important and exciting event in any all-star weekend of any basketball league. In this contest, each participant takes 25 shots, from 5 different spots in the court. Each shot scored gives one point to the player, except for the last shot in each spot which gives two points if scored. In this problem, you must write a program that takes as input the information of a three point shooting contest and sorts the players by the points scored in descending order. In the event of a tie, the players must be lexicographically sorted. Input The input consist of several test cases. Each test case consist of a line with an integer P representing the number of players (0 < P < 101). Each of the next P lines is formatted as follows: Player name;# # # # #;# # # # #;# # # # #;# # # # #;# # # # # The# # # # #representthefiveshotsateachspot;each#iseither1iftheshotwasscoredor0ifitwas missed. The player name is a non-empty sequence of at most 20 symbols, only including letters from the English alphabet and spaces. You can assume that no leading or trailing spaces occur in a name, and no two players have the same name. The input must be read from standard input. Output For each test case output P + 1 lines. The first of those lines is the case number in the format ‘‘Case N:’’ where N is the case number starting at 1. Each of the next P lines lines contain the name of a player (as it appear in the input) and the total number of points scored in the contest. The list of names must be sorted in descending order relative to the points scored. If there is a tie, then sort the names in case-insensitive lexicographical ascending order. See the sample output for details on the format. The output must be written to standard output.

2018 ACIS REDIS - XXXII Colombian Programming Contest - ACM ICPC 2 Sample Input 3 Michael Jordan;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;0 0 0 0 1 Scotty Pippen;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;0 0 0 1 1 Charles Barkley;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;0 0 1 1 1 3 Michael;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;1 1 1 1 1 Scotty;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;1 1 1 1 1 Charles;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;1 1 1 1 1 3 Charles Barkley;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;1 1 1 1 1 Charle s Barkley;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;1 1 1 1 1 Charl es Barkley;0 1 1 0 1;0 1 1 0 1;0 1 1 0 1;0 0 0 0 1;1 1 1 1 1 Sample Output Case 1: Charles Barkley 18 Scotty Pippen 17 Michael Jordan 16 Case 2: Charles 20 Michael 20 Scotty 20 Case 3: Charl es Barkley 20 Charle s Barkley 20 Charles Barkley 20