eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Digital Clock

Digital Clock

Electronic equipment commonly uses \textbf{7}-segment elements to show numbers. A \textbf{7}-segment element gets its name because it uses \textbf{7} line segments to show a shape: \textbf{3} horizontal segments and \textbf{4} vertical segments. Each segment can be independently switched on and off, making it possible to show any digit from \textbf{0} to \textbf{9}. \includegraphics{https://static.e-olymp.com/content/9d/9de9eb9a5227914cc51d1bc5d2eeb0bba2919b60.jpg} \textit{\textbf{Figure 1}}: The \textbf{7}-segment patterns of the decimal digits. To show more than 1 digit at the same time, a larger display is constructed by putting multiple \textbf{7}-segment elements next to each other. In this case, each segment in each digit can be independently switched on and off. For example, electronic alarm clocks typically use four \textbf{7}-segment elements to show the time of day: two digits for the hour (\textbf{00} to \textbf{23}) and two digits for the minutes (\textbf{00} to \textbf{59}). \includegraphics{https://static.e-olymp.com/content/f5/f56580331484e12ff8597219ecb1e54ad1294654.jpg} You managed to find an old alarm clock in a dusty corner of the basement. Unfortunately, it does not seem to work very well: it does not always show the correct time. You suspect that this is due to faulty wires in the \textbf{7}-segment display. As a result of the faults, some of the segments may not be working at all; they never light up, no matter which digits the clock tries to put on its display. On the other hand, the segments that do sometimes light up should all be working correctly. You thus assume that each of the \textbf{28} segments on the clock is either completely broken (never lights up) or is working perfectly fine (lights up precisely when it should). \textbf{Problem} You want to know what time it is, of course, but the silly clock is not making it very easy. You have been watching the clock for some time, writing down the pattern of digits on its display every minute. (Note that it is possible that the display stays the same for a few minutes. When that happens, you just write down the same pattern several times.) Your task is to find out what time the clock was really trying to show when you wrote down the first pattern of the sequence. The answer must be consistent with all observations of the clock display, for the first minute as well as for the following minutes, under the assumption that each display segment is either completely broken (never lights up) or is working perfectly fine. There may be multiple possible answers. In that case, you should make a list of all possible answers, in order of increasing time of day. It is still possible that the clock is really broken in some other way than just faulty segments. In that case, it may happen that there is no possible answer which is consistent with all observations. \InputFile For each test case, there is one line of input containing the following items: \begin{itemize} \item A positive integer \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{50}), the number of minutes you have been watching the clock. \item N items, each representing a pattern of digits that was observed on the clock. Each pattern is formatted as two decimal digits, followed by a '\textbf{:}' character, followed by two more decimal digits. The patterns are listed in the order in which they were seen on the clock. \end{itemize} It is theoretically possible for a faulty \textbf{7}-segment display to show a shape which does not correspond to any of the digits from \textbf{0} to \textbf{9}. However, for some mysterious reason, this never happened during the time you were watching the clock. \OutputFile For each test case, give one line of output. If there is at least one possible answer, print a list of all possible answers separated by spaces. Each possible answer must be a valid \textbf{24}-hour clock time, formatted as two digits (\textbf{00} to \textbf{23}), followed by a '\textbf{:}' character, followed by two digits (\textbf{00} to \textbf{59}). The list of possible answers must be printed in order of increasing time of day. If there is no possible answer, print the word '\textbf{none}'.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
1 88:88
2 23:25 23:26
3 71:57 71:57 71:07
Вихідні дані #1
none
23:25
00:58 03:58 07:58 08:58
Джерело NWERC 2012 - NorthWestern European Regional Championship 2012