Billboard
TCI '02 Round 3 · 2002-10-23 · by chogyonim
Problem Statement
An electronic billboard is supposed to display large letters by using several lightbulbs per letter. Given a message, and how each enlarged letter looks as a 5x5 arrangement of lightbulbs, return the enlarged message.
The enlarged representation of the letters will be in a
"<letter>:*****-*****-*****-*****-*****"
Where <letter> is a single uppercase letter [A-Z], and each * is either the character '#' (representing a lit lightbulb) or a period ('.') (representing an unlit lightbulb). Each group of 5 (delimited by a dash, '-') represents a row in the 5x5 representation of the letter. So, "T:#####-..#..-..#..-..#..-..#.." means that the 5x5 representation of 'T' is:
"#####" "..#.." "..#.." "..#.." "..#.."
Return the enlarged message as a 5-element
Constraints
- message will contain between 1 and 10 characters, inclusive.
- each character of message will be an uppercase letter [A-Z].
- letters will contain between 1 and 10 elements, inclusive.
- each element of letters will be exactly 31 characters in length.
- each element of letters will be formatted as (quotes added for clarity): "
:*****-*****-*****-*****-*****", where is a single uppercase letter [A-Z] (inclusive) representing the letter being enlarged, and each * is either the character '#' or a period. - every letter appearing in message will have an enlarged representation in letters.
- each letter represented in letters will be unique.
"TOPCODER"
{"T:#####-..#..-..#..-..#..-..#.."
,"O:#####-#...#-#...#-#...#-#####"
,"P:####.-#...#-####.-#....-#...."
,"C:.####-#....-#....-#....-.####"
,"D:####.-#...#-#...#-#...#-####."
,"E:#####-#....-####.-#....-#####"
,"R:####.-#...#-####.-#.#..-#..##"}
Returns: { "#####.#####.####...####.#####.####..#####.####.", "..#...#...#.#...#.#.....#...#.#...#.#.....#...#", "..#...#...#.####..#.....#...#.#...#.####..####.", "..#...#...#.#.....#.....#...#.#...#.#.....#.#..", "..#...#####.#......####.#####.####..#####.#..##" }
"DOK"
{"D:####.-#...#-#...#-#...#-####."
,"O:#####-#...#-#...#-#...#-#####"
,"K:#...#-#..#.-###..-#..#.-#...#"}
Returns: { "####..#####.#...#", "#...#.#...#.#..#.", "#...#.#...#.###..", "#...#.#...#.#..#.", "####..#####.#...#" }
"RANDOMNESS"
{"S:##.##-#####-#.#.#-#.#.#-####."
,"N:#####-#####-#####-#####-#####"
,"R:#####-#####-##.##-#####-#####"
,"A:.....-.....-.....-.....-....."
,"D:#.#.#-.#.#.-#.#.#-.#.#.-#.#.#"
,"O:#####-#...#-#.#.#-#...#-#####"
,"E:#....-.#...-..#..-...#.-....#"
,"M:#....-.....-.....-.....-....."
,"X:#...#-.#.#.-..#..-.#.#.-#...#"}
Returns: { "#####.......#####.#.#.#.#####.#.....#####.#.....##.##.##.##", "#####.......#####..#.#..#...#.......#####..#....#####.#####", "##.##.......#####.#.#.#.#.#.#.......#####...#...#.#.#.#.#.#", "#####.......#####..#.#..#...#.......#####....#..#.#.#.#.#.#", "#####.......#####.#.#.#.#####.......#####.....#.####..####." }
Note that the letter X is defined but never used.
"ABCDE"
{"A:..#..-.#.#.-#####-#...#-#...#","B:####.-#...#-####.-#...#-####.","C:#####-#....-#....-#....-#####","D:####.-#...#-#...#-#...#-####.","E:#####-#....-####.-#....-#####"}
Returns: { "..#...####..#####.####..#####", ".#.#..#...#.#.....#...#.#....", "#####.####..#.....#...#.####.", "#...#.#...#.#.....#...#.#....", "#...#.####..#####.####..#####" }
"SKINNY"
{"S:..##.-.#...-..#..-...#.-.##..","K:.#.#.-.##..-.#...-.##..-.#.#.","I:.###.-..#..-..#..-..#..-.###.","N:.#.#.-.###.-.###.-.###.-.#.#.","Y:.#.#.-.#.#.-..#..-..#..-..#.."}
Returns: { "..##...#.#...###...#.#...#.#...#.#.", ".#.....##.....#....###...###...#.#.", "..#....#......#....###...###....#..", "...#...##.....#....###...###....#..", ".##....#.#...###...#.#...#.#....#.." }
Submissions are judged against all 25 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Billboard with a public method vector<string> enlarge(string message, vector<string> letters) · 25 test cases · 2 s / 256 MB per case