Hello
In the distant future, when cyborgs on Olympia have entirely replaced humans, a central societal issue will emerge: cyborgs who prefer the aesthetic of a mechanical watch will struggle to read the current time from it.
Task
Address this existential challenge now! Develop a program named watcha
that can determine the current time based on the appearance of a mechanical watch.
Input Data
The input consists of one or more black-and-white images of a clock. The file contains one or more blocks, with up to 20
blocks in total. Each block is composed of 128
rows, each containing 128
characters. Each character is either a 0
(representing a white pixel: background) or a 1
(representing a black pixel: clock element). There are no spaces between characters. Blocks are separated by empty lines (one empty line between each pair of adjacent blocks). The input always depicts a clock of a single type, as shown below. Additionally, the clock is always the same size: the first and last rows and columns form a frame of white pixels, while the second and penultimate rows and columns contain at least one black pixel of the clock.
Output Data
The output should consist of as many lines as there are blocks in the input file. Each line should indicate the time displayed on the clock in the corresponding block, formatted as hours (from 1
to 12
, without leading zeros) followed by a colon and the minutes.
Evaluation
The test set includes 50
tests of equal value.