img
Czech Technical University in Prague
Faculty of Mathematics and Physics, Charles University in Prague
Faculty of Electrical Engineering and Computer Science, Technical University of Ostrava
Faculty of Informatics and Information Technologies, Slovak University of Technology
acm
Faculty of Informatics, Masaryk University
cz
Faculty of Management Science and Informatics, University of Zilina
CTU Open Contest 2009
Clock Captcha
cc.c, cc.C, cc.java, cc.p
The digital display clock installed in problem dd is only one part of the solution to eliminate
antedating documents. The second part is a camera which takes pictures of the office regularly
and records at what times was each document signed and stamped. These records can later
serve as an evidence.
Your task is to scan a picture take by the camera and decode numbers on the digital display.
Input Specification
The input will exactly follow Output Specification for Problem dd, with only one important
exception: Since image scanning is always an error-prone process, some of the characters repre-
senting the display may not be recognized correctly. Fortunately, we know which characters are
incorrect, because a very sophisticated error-detecting mechanism is used. These characters are
replaced by dots (".") in the input. Such spots can represent any of the allowed characters.
Output Specification
Your output must follow Input Specification for Problem dd. For each display, output the time
shown on it. You may assume that at least one such time exists.
However, due to the scanning errors, sometimes there may be several possible valid times that
could be represented by the same picture. In such cases, we may not risk giving an incorrect
information -- print the word "ambiguous" instead of the time.
Sample Input
....+
+---+
+---+  +---+
...|
|
.....
|
...|
|
.
..
...
....+
+-...
+--....
+
......
|o|
.....  |
...
...
....
|
....+
+---+
+---+
+
....+  +---+
+---+  +---+
...|
|
.....
|
...|
|.
..
...
....+  +-...
+--....
+
......
|o|
.....  |
...
...
....
|
....+  +---+
+---+
+
end
Output for Sample Input
15:27
ambiguous
end