#P6920. Clock Fault Diagnosis
Clock Fault Diagnosis
Clock Fault Diagnosis
ACME Clock Manufacturers have produced clocks with defective LCD segments. After numerous unfortunate incidents and ensuing lawsuits, the executives have finally decided to address the quality control issues. As a quality consultant, your task is to analyze a series of clock displays recorded at consecutive minutes and deduce for each segment whether it is definitely malfunctioning or definitely working.
The clock displays time in 24-hour format as HH:MM using standard 7-segment digits for the hour and minute digits and a 2-segment display for the colon. (Note that in a perfectly functioning clock, the colon segments are always lit.) Each digit is represented by 7 segments labeled as follows:
$$\begin{array}{ccc} & a & \\ f & & b \\ & g & \\ e & & c \\ & d & \end{array} $$The standard mapping from digit to segments is defined as:
- 0: $a,b,c,d,e,f$ on, $g$ off:
1111110
- 1: $b,c$ on:
0110000
- 2: $a,b,d,e,g$ on:
1101101
- 3: $a,b,c,d,g$ on:
1111001
- 4: $b,c,f,g$ on:
0110011
- 5: $a,c,d,f,g$ on:
1011011
- 6: $a,c,d,e,f,g$ on:
1011111
- 7: $a,b,c$ on:
1110000
- 8: all on:
1111111
- 9: $a,b,c,d,f,g$ on:
1111011
The colon is represented by 2 segments which are intended to be on in a properly functioning clock (i.e. 11
).
Because some segments may be permanently off (burnt out) or permanently on (burnt in), the observed pattern for a digit might differ from its ideal representation. Moreover, the clock advances one minute between consecutive observations; however, the starting time is not given.
Your program should determine for each segment (in each of the 5 display parts: hour tens, hour ones, colon, minute tens, minute ones) whether its status is:
- W if it is definitely working normally,
- B if it is definitely burnt out,
- I if it is definitely burnt in,
- ? if its status cannot be determined with certainty.
- Hour tens (7 characters corresponding to segments a, b, c, d, e, f, g)
- Hour ones (7 characters)
- Colon (2 characters: left then right)
- Minute tens (7 characters)
- Minute ones (7 characters)
- Hour tens digit: a 7-character string, with each character being either '1' (lit) or '0' (unlit), corresponding to segments a, b, c, d, e, f, g.
- Hour ones digit: 7-character string (same format as above).
- Colon: a 2-character string representing the left and right colon segments.
- Minute tens digit: 7-character string.
- Minute ones digit: 7-character string.
- Hour tens (7 characters)
- Hour ones (7 characters)
- Colon (2 characters)
- Minute tens (7 characters)
- Minute ones (7 characters)
- W: if the segment is definitely working normally.
- B: if the segment is definitely burnt out.
- I: if the segment is definitely burnt in.
- ?: if its status cannot be determined with certainty.
For the purpose of output, list the status of the segments in the following order:
Separate these 5 groups by a single space.
inputFormat
The first line of input contains an integer n (with n ≥ 3), the number of consecutive observations.
Each of the next n lines contains 5 space‐separated strings representing the observed state of each part of the clock in order:
Note that due to malfunctions, the observed state might not match the ideal pattern for the digit that should be displayed at that position.
outputFormat
Output 5 space-separated strings, corresponding to the five display parts in order:
For each character, output exactly one of the following letters:
The groups should be separated by a single space.
sample
3
0110000 1101101 11 1111001 0110011
0110000 1101101 11 1111001 1011011
0110000 1101101 11 1111001 1011111
WWWWWWW WWWWWWW WW WWWWWWW WWWWWWW