Status:  Past  Start:  20121013 12:15:00  End:  20121013 16:15:00 
The 2012 Caribbean National Contests of the ACMICPC (CUB)
Problem
2068  Caribbean Ranking
Created by  Yonny Mondelo Hernández 
Added by  ymondelo20 (20121012) 
Limits 
Total Time: 10000 MS

Test Time:
2000 MS
Memory: 62 MB  Output: 64 MB  Size:
29 KB

Enabled languages  
Available in 
Description
Today your task is simple: you only have to make an application capable of generating the general ranking of the 2012 ACMICPC Caribbean Local Contests (CLC), from the results obtained in each of its sites (CLC has no more than 50 sites). Each site has no more than 180 registered teams, and no more than 20 guest teams (in other words, no more than 200 teams in total). Each team is characterized by the following data:
For sorting the teams in the general ranking, you must take into account the following rules:
There will be no two teams that match in Nickname, SolvedProblems, and TotalTime at the same time.
 Institution: A single word of no more than 10 characters ('a''z', 'A''Z', '', '_').
 Username: A single word of no more than 30 characters ('a''z', 'A''Z', '0''9', '+', '', '!', '@', '#', '$', '%', '^', '&', '*').
 Nickname: A sequence of words. Its length is no more than 30 characters ('a''z', 'A''Z', '0''9', '+', '', '!', '?', '@', '#', '$', '%', '^', '&', '*', '(', ')', ',', '.', ' ', '_').
 SolvedProblems: Integer number between 0 and 9.
 TotalTime: Integer number between 0 and 9999.
For sorting the teams in the general ranking, you must take into account the following rules:
 Rule#1: If TeamA solves more problems than TeamB, then TeamA is higher in the rank (if there is a tie, use Rule#2).
 Rule#2: If TeamA solves the problems in a total time less than TeamB's total time, then TeamA is higher in the rank (if there is a tie, use Rule#3).
 Rule#3: If TeamA's Nickname is lexicographically smaller than TeamB's Nickname, then TeamA is higher in the rank.
There will be no two teams that match in Nickname, SolvedProblems, and TotalTime at the same time.
Today your task is simple: you only have to make an application capable of generating the general ranking of the 2012 ACMICPC Caribbean Local Contests (CLC), from the results obtained in each of its sites (CLC has no more than 50 sites). Each site has no more than 180 registered teams, and no more than 20 guest teams (in other words, no more than 200 teams in total). Each team is characterized by the following data:
For sorting the teams in the general ranking, you must take into account the following rules:
There will be no two teams that match in Nickname, SolvedProblems, and TotalTime at the same time.
 Institution: A single word of no more than 10 characters ('a''z', 'A''Z', '', '_').
 Username: A single word of no more than 30 characters ('a''z', 'A''Z', '0''9', '+', '', '!', '@', '#', '$', '%', '^', '&', '*').
 Nickname: A sequence of words. Its length is no more than 30 characters ('a''z', 'A''Z', '0''9', '+', '', '!', '?', '@', '#', '$', '%', '^', '&', '*', '(', ')', ',', '.', ' ', '_').
 SolvedProblems: Integer number between 0 and 9.
 TotalTime: Integer number between 0 and 9999.
For sorting the teams in the general ranking, you must take into account the following rules:
 Rule#1: If TeamA solves more problems than TeamB, then TeamA is higher in the rank (if there is a tie, use Rule#2).
 Rule#2: If TeamA solves the problems in a total time less than TeamB's total time, then TeamA is higher in the rank (if there is a tie, use Rule#3).
 Rule#3: If TeamA's Nickname is lexicographically smaller than TeamB's Nickname, then TeamA is higher in the rank.
There will be no two teams that match in Nickname, SolvedProblems, and TotalTime at the same time.
Today your task is simple: you only have to make an application capable of generating the general ranking of the 2012 ACMICPC Caribbean Local Contests (CLC), from the results obtained in each of its sites (CLC has no more than 50 sites). Each site has no more than 180 registered teams, and no more than 20 guest teams (in other words, no more than 200 teams in total). Each team is characterized by the following data:
For sorting the teams in the general ranking, you must take into account the following rules:
There will be no two teams that match in Nickname, SolvedProblems, and TotalTime at the same time.
 Institution: A single word of no more than 10 characters ('a''z', 'A''Z', '', '_').
 Username: A single word of no more than 30 characters ('a''z', 'A''Z', '0''9', '+', '', '!', '@', '#', '$', '%', '^', '&', '*').
 Nickname: A sequence of words. Its length is no more than 30 characters ('a''z', 'A''Z', '0''9', '+', '', '!', '?', '@', '#', '$', '%', '^', '&', '*', '(', ')', ',', '.', ' ', '_').
 SolvedProblems: Integer number between 0 and 9.
 TotalTime: Integer number between 0 and 9999.
For sorting the teams in the general ranking, you must take into account the following rules:
 Rule#1: If TeamA solves more problems than TeamB, then TeamA is higher in the rank (if there is a tie, use Rule#2).
 Rule#2: If TeamA solves the problems in a total time less than TeamB's total time, then TeamA is higher in the rank (if there is a tie, use Rule#3).
 Rule#3: If TeamA's Nickname is lexicographically smaller than TeamB's Nickname, then TeamA is higher in the rank.
There will be no two teams that match in Nickname, SolvedProblems, and TotalTime at the same time.
Input specification
The first line of the input is '1' or '0':
 if '1' you should include the guest teams in the general ranking.
 if '0' you should not include the guest teams in the general ranking
 In the first line, the institution to which belong all teams in the site (enclosed in brackets), followed by two integers representing the number of inscribed teams (0 <= IT <= 180) and the number of guest teams (0 <= GT <= 20).
 In each of the IT following lines, there are the information about one inscribed team of the site.
 In each of the GT following lines, there are the information about one guest team of the site.
 The information about teams will be given in the following format: Username [Nickname] SolvedProblems TotalTime
 Logically, if one team solves zero problems, then the total time, will be zero too.
The first line of the input is '1' or '0':
 if '1' you should include the guest teams in the general ranking.
 if '0' you should not include the guest teams in the general ranking
 In the first line, the institution to which belong all teams in the site (enclosed in brackets), followed by two integers representing the number of inscribed teams (0 <= IT <= 180) and the number of guest teams (0 <= GT <= 20).
 In each of the IT following lines, there are the information about one inscribed team of the site.
 In each of the GT following lines, there are the information about one guest team of the site.
 The information about teams will be given in the following format: Username [Nickname] SolvedProblems TotalTime
 Logically, if one team solves zero problems, then the total time, will be zero too.
The first line of the input is '1' or '0':
 if '1' you should include the guest teams in the general ranking.
 if '0' you should not include the guest teams in the general ranking
 In the first line, the institution to which belong all teams in the site (enclosed in brackets), followed by two integers representing the number of inscribed teams (0 <= IT <= 180) and the number of guest teams (0 <= GT <= 20).
 In each of the IT following lines, there are the information about one inscribed team of the site.
 In each of the GT following lines, there are the information about one guest team of the site.
 The information about teams will be given in the following format: Username [Nickname] SolvedProblems TotalTime
 Logically, if one team solves zero problems, then the total time, will be zero too.
Output specification
You must print the general ranking, in the same format used below (see the sample).
 Rightaligned column, of width 5, with the RANKS (pad numbers with leading zeros).
 Blank column, of width 3.
 Leftaligned column, of width 30, with the NICKNAMES.
 Rightaligned column, of width 6, with the SOLVED PROBLEMS (without leading zeros).
 Blank column, of width 3.
 Rightaligned column, of width 10, with the TOTAL TIME (without leading zeros).
 Blank column, of width 3.
 Leftaligned column, of width 11, with the INTITUTIONS.
 Blank column, of width 3.
 Leftaligned column, of width 30, with the USERNAMES.
You must follow the exact format described in the statement. Except for the last column, all the remaining chars must be filled with whitespaces (trailing spaces are not needed, after username).
;jsessionid=7164AF0DB5F532DB4BDD868FF77AAEA3
You must print the general ranking, in the same format used below (see the sample).
 Rightaligned column, of width 5, with the RANKS (pad numbers with leading zeros).
 Blank column, of width 3.
 Leftaligned column, of width 30, with the NICKNAMES.
 Rightaligned column, of width 6, with the SOLVED PROBLEMS (without leading zeros).
 Blank column, of width 3.
 Rightaligned column, of width 10, with the TOTAL TIME (without leading zeros).
 Blank column, of width 3.
 Leftaligned column, of width 11, with the INTITUTIONS.
 Blank column, of width 3.
 Leftaligned column, of width 30, with the USERNAMES.
You must follow the exact format described in the statement. Except for the last column, all the remaining chars must be filled with whitespaces (trailing spaces are not needed, after username).
;jsessionid=7164AF0DB5F532DB4BDD868FF77AAEA3The first line of the input is '1' or '0':
 if '1' you should include the guest teams in the general ranking.
 if '0' you should not include the guest teams in the general ranking
 In the first line, the institution to which belong all teams in the site (enclosed in brackets), followed by two integers representing the number of inscribed teams (0 <= IT <= 180) and the number of guest teams (0 <= GT <= 20).
 In each of the IT following lines, there are the information about one inscribed team of the site.
 In each of the GT following lines, there are the information about one guest team of the site.
 The information about teams will be given in the following format: Username [Nickname] SolvedProblems TotalTime
 Logically, if one team solves zero problems, then the total time, will be zero too.
Sample input
1
[Elai_UNIC] 4 0
ElaiTeam1! [Elai Team #1] 0 0
Elai++&**! [ElaiTeam +&*!!] 3 999
Elai1024@^2 [Elai1024@^2 Winners] 7 4567
Elai$$%%##! [Elai$$%%##! 1nv1ctu5] 9 9999
[ELAI] 0 4
Team1 [Guest01] 3 300
Team2 [Guest02] 4 450
Team3 [Guest03] 5 600
Team4 [Guest04] 5 900
[UNIC] 2 2
UnicTeamW [WINNERS] 1 9999
UnicTeamL [LOOSERS] 1 1
TeamG1 [GuestT01] 3 300
TeamG2 [GuestT02] 4 450
Sample output
RANK NICKNAME SOLVED TOTALTIME INSTITUTION COJUSERNAME
00001 Elai$$%%##! 1nv1ctu5 9 9999 Elai_UNIC Elai$$%%##!
00002 Elai1024@^2 Winners 7 4567 Elai_UNIC Elai1024@^2
00003 Guest03 5 600 ELAI Team3
00004 Guest04 5 900 ELAI Team4
00005 Guest02 4 450 ELAI Team2
00006 GuestT02 4 450 UNIC TeamG2
00007 Guest01 3 300 ELAI Team1
00008 GuestT01 3 300 UNIC TeamG1
00009 ElaiTeam +&*!! 3 999 Elai_UNIC Elai++&**!
00010 LOOSERS 1 1 UNIC UnicTeamL
00011 WINNERS 1 9999 UNIC UnicTeamW
00012 Elai Team #1 0 0 Elai_UNIC ElaiTeam1!
Hint(s)
http://coj.uci.cu/contest/
http://coj.uci.cu/contest/
http://coj.uci.cu/contest/