Editorial for WC '17 Contest 3 J4 - Meme Generator
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Upon reading in the input, the trickiest part is determining where exactly the and strings should be overlaid onto the image grid, such that they end up centered as required.
Let be the number of characters in . Then, the first character of should replace character in the second row of the image grid (-indexed). At that point, we can iterate over each character (for ), and if isn't an underscore, we should replace character in the second row of the image grid with .
The same process can be repeated to overlay onto the second-last row of the image grid. Following that, we can proceed to output the entire updated image grid, one row at a time.
Comments