A competitive programming problem for the DOM Judge platform. Originally written for the UWA PCS.
Sample input and output data for three levels of complexity are provided, with an editorial explaining potential solutions of each complexity level, and sample code for the intended solution. Complexity is set with an expected 2 second maximum run time in mind, and C++ as the standard language, slower languages such as Python are not guaranteed to pass when using a solution with the correct level of complexity.
For obvious reasons you should not read the editorial if you intend to solve the solution yourself.
NB: TeX formatting is written in a non-standard ~
delimited format. Depending on the plugin that you choose to use on your judge server you may need to modify the propmt and editorial documents to a $
delimited format, or whatever is appropriate for your system.