[email protected] High School Programming Competition 2020

#### Start

2020-04-25 08:23 AKDT

## [email protected] High School Programming Competition 2020

#### End

2020-04-25 11:53 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -750 days 21:48:05

3:30:00

0:00:00

# Problem Bbrokenclock

Photo by iizukak. Retrieved from hackster.io. https://www.hackster.io/iizukak/unix-time-clock-7fa413

For your birthday you asked for a new digital clock which shows the time as the UNIX Timestamp which is defined as the number of seconds from the UNIX epoch (00:00:00 on January 1, 1970). Unfortunately, instead of the cool clock that you wanted, you were given a normal digital clock which shows the time in HH:MM:SS format. You were so disappointed after receiving your new clock that you threw it in the air and it landed on the floor with a crash! After apologizing to the people that gave you the gift, you realize that the clock is not totally broken. Some of the bars (segments) on the display are broken and are permanently off and won’t turn on. While others work properly and turn on and off as expected.

Because you still want to be able to tell the time, you decide to write a program to figure out what times the clock could be displaying.

The clock is laid out as follows. There are 6 digits on your clock. Every two digits is separated by a colon creating three digit groups representing the hours, minutes, and seconds of the time, respectively. The time is displayed in HH:MM:SS format where

• HH is the hours in 24 hour format (meaning that the hours range from 00 to 23), with a leading zero if the hours part of the time is only a single digit.

• MM is the minutes, with a leading zero if the minutes part of the time is only a single digit.

• SS is the seconds, with a leading zero if the seconds part of the time is only a single digit.

Each digit has seven segments which can either be on, off, or broken. The segment layout for a single digit and the corresponding segment numbers are shown in Figure 1.

If all of the segments of a digit are not broken, then the numbers 0 through 9 are displayed by illuminating the segments as shown in Figure 2.

## Input

There are six lines of input. The ${n}^{th}$ line of the input represents the states of the segments of the ${n}^{th}$ digit from the left of the clock. Each line will consist of seven space-separated values representing the states of the seven segments of the corresponding digit. A 1 indicates that the given segment is “lit”. A 0 indicates that the segment is “off”, but not broken. A - indicates that the segment is broken.

You are guaranteed that each of the digits in the display has at least one possible number and that the clock can represent at least one valid 24-hour time.

## Output

Output the possible times that the clock could be displaying in sorted order (least to greatest) with leading zeros in HH:MM:SS format (the same format as described above).

Sample Input 1 Sample Output 1
0 0 1 0 0 1 0
1 0 1 1 1 0 1
1 1 1 0 1 1 1
1 0 1 1 0 1 1
1 1 1 0 1 1 1
1 - - 1 - - 1

12:03:02
12:03:03
12:03:05
12:03:06
12:03:08

Sample Input 2 Sample Output 2
1 1 1 0 1 1 1
1 1 - 1 - 1 1
- - - - - - -
0 0 1 - 0 1 0
0 0 1 0 0 1 0
0 1 1 1 0 1 0

05:01:14
05:11:14
05:21:14
05:31:14
05:41:14
05:51:14
06:01:14
06:11:14
06:21:14
06:31:14
06:41:14
06:51:14
08:01:14
08:11:14
08:21:14
08:31:14
08:41:14
08:51:14