19
\$\begingroup\$

Many digital clocks display the time using simplified digits comprised of only seven different lights that are either on or off:

When mirrored horizontally, the digits 018 don't change because they are symmetrical. Also, the digits 2 and 5 get swapped, 2 becoming 5 and vice versa. All the other digits become invalid when mirrored.

Thus, given a 24-hour digital clock, there are many clock readings such that the mirrored image of the digital display is also a valid clock reading. Your task is to output all such clock readings along with the mirrored readings.

For example, 22:21 becomes 15:55, and 00:15 becomes 21:00. On the other hand, 12:34 or 16:27 are no longer valid when mirrored (digits 34679 become invalid), and neither are 22:22 or 18:21, because, as there are only 24 hours in a day and 60 minutes in an hour, no sane clock would display 55:55 or 12:81.

Task

Write a program or a function that takes no input and outputs all valid pairs in ascending order as shown below:

00:00 - 00:00
00:01 - 10:00
00:05 - 20:00
00:10 - 01:00
00:11 - 11:00
00:15 - 21:00
00:20 - 05:00
00:21 - 15:00
00:50 - 02:00
00:51 - 12:00
00:55 - 22:00
01:00 - 00:10
01:01 - 10:10
01:05 - 20:10
01:10 - 01:10
01:11 - 11:10
01:15 - 21:10
01:20 - 05:10
01:21 - 15:10
01:50 - 02:10
01:51 - 12:10
01:55 - 22:10
02:00 - 00:50
02:01 - 10:50
02:05 - 20:50
02:10 - 01:50
02:11 - 11:50
02:15 - 21:50
02:20 - 05:50
02:21 - 15:50
02:50 - 02:50
02:51 - 12:50
02:55 - 22:50
05:00 - 00:20
05:01 - 10:20
05:05 - 20:20
05:10 - 01:20
05:11 - 11:20
05:15 - 21:20
05:20 - 05:20
05:21 - 15:20
05:50 - 02:20
05:51 - 12:20
05:55 - 22:20
10:00 - 00:01
10:01 - 10:01
10:05 - 20:01
10:10 - 01:01
10:11 - 11:01
10:15 - 21:01
10:20 - 05:01
10:21 - 15:01
10:50 - 02:01
10:51 - 12:01
10:55 - 22:01
11:00 - 00:11
11:01 - 10:11
11:05 - 20:11
11:10 - 01:11
11:11 - 11:11
11:15 - 21:11
11:20 - 05:11
11:21 - 15:11
11:50 - 02:11
11:51 - 12:11
11:55 - 22:11
12:00 - 00:51
12:01 - 10:51
12:05 - 20:51
12:10 - 01:51
12:11 - 11:51
12:15 - 21:51
12:20 - 05:51
12:21 - 15:51
12:50 - 02:51
12:51 - 12:51
12:55 - 22:51
15:00 - 00:21
15:01 - 10:21
15:05 - 20:21
15:10 - 01:21
15:11 - 11:21
15:15 - 21:21
15:20 - 05:21
15:21 - 15:21
15:50 - 02:21
15:51 - 12:21
15:55 - 22:21
20:00 - 00:05
20:01 - 10:05
20:05 - 20:05
20:10 - 01:05
20:11 - 11:05
20:15 - 21:05
20:20 - 05:05
20:21 - 15:05
20:50 - 02:05
20:51 - 12:05
20:55 - 22:05
21:00 - 00:15
21:01 - 10:15
21:05 - 20:15
21:10 - 01:15
21:11 - 11:15
21:15 - 21:15
21:20 - 05:15
21:21 - 15:15
21:50 - 02:15
21:51 - 12:15
21:55 - 22:15
22:00 - 00:55
22:01 - 10:55
22:05 - 20:55
22:10 - 01:55
22:11 - 11:55
22:15 - 21:55
22:20 - 05:55
22:21 - 15:55
22:50 - 02:55
22:51 - 12:55
22:55 - 22:55

A trailing or a leading newline is allowed. Having a few spaces directly before a linefeed is also allowed. The times must be in format hh:mm, padded with zeros when necessary.

This is , so the shortest answer in bytes wins. As usual, standard loopholes are disallowed.

\$\endgroup\$
6
  • \$\begingroup\$ In Clean, a String is an array of Char. Is it acceptable if my answer gives a list of Char? The types look identical when bare-printed. \$\endgroup\$
    – Οurous
    Dec 18, 2017 at 22:34
  • \$\begingroup\$ @Ourous Yes, I think it's fine. The consensus on meta seems to be that a string is a sequence of characters, and that's what a list of characters is. \$\endgroup\$
    – Steadybox
    Dec 18, 2017 at 22:39
  • \$\begingroup\$ In this seven-segment display, the digit 1 is not exactly identical to its mirror image because you can tell if the right-most segments or the left-most segments are used to form the vertical "line" which makes up the digit. I understand that we consider them identical here. \$\endgroup\$ Dec 18, 2017 at 22:43
  • \$\begingroup\$ @JeppeStigNielsen let's pretend OP used an image with 14seg displays instead of 7seg, so the 1 could be centered. \$\endgroup\$
    – Sparr
    Dec 19, 2017 at 0:17
  • 3
    \$\begingroup\$ @Steadybox Wow, I had this exact idea recently. I plan to use it on people during programming interviews. BTW I have a microwave oven which does not have a sane clock and allows you to specify things like 83:75 :-) \$\endgroup\$
    – JohnEye
    Dec 19, 2017 at 2:32

17 Answers 17

6
\$\begingroup\$

Python 2, 187 180 178 177 bytes

R=range(11)
for t in['0000111122201250125012'[j::11]+':'+'0001112255501501501015'[i::11]for i in R for j in R]:print t+' - '+''.join(map(dict(zip('0125:','0152:')).get,t))[::-1]

Try it online!

Thanks for +1 Kevin Cruijssen.

\$\endgroup\$
0
5
\$\begingroup\$

APL (Dyalog Unicode), 84 bytesSBCS

Complete program outputting to STDOUT. Requires ⎕IO (Index Origin) to be 0 which is default on many systems.

{0::⋄∧/23 59≥⍎¨(':'≠t)⊆t←⌽'015xx2xx8x:'[⎕D⍳i←∊⍺':'⍵]:⎕←1↓⍕i'-'t}⌿1↓¨⍕¨100+0 60⊤⍳1440

Try it online!

⍳1440 that many ɩntegers

0 60⊤ convert to mixed-base ∞,60

100+ add 100 (this pads the needed 0s)

⍕¨ format (stringify) each

1↓¨ drop the first character from each (this removes the leading 1s)

{}⌿ apply the following anonymous function column-wise ( is top hour, is minute)

0:: if any error happens, return nothing

 try:

  '015xx2xx8x:'[] index this string with:

   ∊⍺':'⍵ the ϵnlisted (flattened) list of hour, colon, minute

   i← stored in i (for input)

   ⎕D⍳ɩndices of each character in the list of Digits

   reverse that

  t← store as t (for time)

  ()⊆ group runs where:

   ':'≠t colon differs from t

⍎¨ execute (evaluate) each

23 59≥ Boolean for each whether they are less than or equal to 23 and 59 respectively

∧/ are both true?

: if so, then:

  ⍕i'-'t the formatted (space-separated) list of input, dash, time

  1↓ drop the first (space)

  ⎕← output to STDOUT

\$\endgroup\$
4
\$\begingroup\$

Retina, 57 bytes


 - 
+m`^.{3,9}$
0$&0¶1$&1¶2$&5¶5$&2
A`\b2?5
\b\d.
$&:
O`

Try it online! Explanation:


 - 

Insert the separator.

+m`^.{3,9}$
0$&0¶1$&1¶2$&5¶5$&2

Generate all possible sets of four mirrored digits.

A`\b2?5

Delete those with illegal hours.

\b\d.
$&:

Insert the colons.

O`

Sort into order.

\$\endgroup\$
4
\$\begingroup\$

Python 2, 279 277 255 bytes

for h in range(1440):
 q=[[[0,(a+"52")[(a=="2")+(a=="5")*2]][a in"01825"]for a in c]for c in[("%02d"%e)[::-1]for e in[h%60,h/60]]]
 if all(q[0]+q[1]):
	z=[int(''.join(j))for j in q]
	if(z[1]<60)*(z[0]<24):print"%02d:%02d - %02d:%02d"%(h/60,h%60,z[0],z[1])

Try it online!

Credits

  • 279 bytes reduced to 256 by dylnan.

  • 256 bytes reduced to 255 by FlipTrack.

\$\endgroup\$
1
  • \$\begingroup\$ -1 byte \$\endgroup\$
    – FlipTack
    Dec 20, 2017 at 16:51
3
\$\begingroup\$

Clean, 269 ... 172 170 bytes

import StdEnv
?n=toChar n+'0'
$c|c<2=c=7-c
n=[0,1,2,5]
t=flatlines[u++[' - ':v]\\[u,v]<-[[map?[a,b,10,x,y],map?[$y,$x,10,$b,$a]]\\a<-n,b<-n,x<-n,y<-n]|['23:59']>=max u v]

Try it online!

Ungolfed:

import StdEnv
numeral n = toChar (n+48)
mirror 2 = 5
mirror 5 = 2
mirror c = c
digits = [0, 1, 2, 5]
times
    = flatlines [ // flatten with interspersed newlines
        original ++ [' - ' : reflection] // insert separator
        \\ // generate all pairs of times and their mirrored copies
        [original, reflection] <- [
            [map numeral [a, b, 10, x, y], map (numeral o mirror) [y, x, 10, b, a]]
            \\ // generate every combination of display digits
            a <- digits,
            b <- digits,
            x <- digits,
            y <- digits
            ]
        | ['23:59'] >= max original reflection // make sure both times actually exist
        ]
\$\endgroup\$
2
\$\begingroup\$

05AB1E, 34 bytes

0125DâDâεÂ5n‡í)}ʒ€н25‹P}':ý… - ý»

Try it online!

Explanation

0125                                # push "0125"
    Dâ                              # cartesian product with itself
      Dâ                            # cartesian product with itself
        ε       }                   # apply to each
         Â                          # bifurcate
          5n                       # push 25 bifurcated
             ‡                      # transliterate
              í                     # reverse each
               )                    # wrap in a list
                 ʒ      }           # filter each on
                  €н                # head of each
                    25‹             # less than 25
                       P            # product
                         ':ý        # merge on ":"
                            … - ý   # merge on " - "
                                 »  # join on newlines
\$\endgroup\$
2
\$\begingroup\$

Pyth, 48 bytes

Lj\:c2bjf!:T"5.:|25:"0mj" - ",ydyX_d`25)^"0125"4

Try it online!

Generates all possible combinations of 0125 and then manipulates them into the times. These are in the correct order because they are generated in lexicographic order. Finally, this filters out the extra invalid times by removing lines that match the regex 5.: or 25:. Sadly, it doesn't seem like compression works nicely on any of the strings that this program uses, unless I've made an error or oversight.

\$\endgroup\$
2
\$\begingroup\$

Perl 5, 147 bytes

map{$h=0 x($_<10).$_;map{$_="0$_"if$_<10;say"$h:$_ - $q:$i"if($i=reverse$h=~y/25/52/r)<60&&"$h$_"!~/[34679]/&&($q=reverse y/25/52/r)<24}0..59}0..23

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Japt v2 (+ -R), 51 bytes

G²Çs4 ùT4 i':2î+" - "+Zw r\d_^Z>1})r3,5Ãkf/5.|25):

Test it online!

Explanation

G²Ç   s4 ùT4 i':2à ®   +" - "+Zw r\d_  ^Z>1})r3,5à kf/5.|25):
G²oZ{Zs4 ùT4 i':2} mZ{Z+" - "+Zw r\dZ{Z^Z>1})r3,5} kf/5.|25):/   Ungolfed

G²              Calculate 16**2, or 256.
  oZ{       }   Create the range [0...256) and map each integer Z to:
Zs4               Convert Z to a base-4 string.  [0, 1, 2, 3, 10, ..., 3331, 3332, 3333]
    ùT4           Pad-left with 0's to length 4. [0000, 0001, 0002, ..., 3331, 3332, 3333]
        i':2      Insert a colon at index 2.     [00:00, 00:01, 00:02, ..., 33:31, 33:32, 33:33]

mZ{      }      Map each string Z in the resulting array to:
Zw r\dZ{     }    Reverse Z, and replace each digit Z' with
        Z^Z>1       Z' xor'd with (Z>1). This turns 2 to 3 and vice versa.
                  We now have [00:00, 10:00, 30:00, 20:00, 01:00, ..., 12:22, 32:22, 22:22]
Z+" - "+          Append this to Z with " - " in between. This gives
                    [00:00 - 00:00, 00:01 - 10:00, 00:02 - 30:00, ..., 33:32 - 32:22, 33:33 - 22:22]
r3,5              Replace all 3s in the result with 5s.
                    [00:00 - 00:00, 00:01 - 10:00, 00:02 - 50:00, ..., 55:52 - 52:22, 55:55 - 22:22]

k               Remove all results that
 f/5.|25):/       match the regex /(5.|25):/g. This removes times with impossible hours.

                Implicit: output result of last expression, joined with newlines (-R)
\$\endgroup\$
0
1
\$\begingroup\$

JavaScript (ES6), 142 bytes

f=(n=0)=>n<176?(s=(g=n=>d[n>>2]+d[n&3])(n%4*4|n/4&3,d='0152')+':'+g(n>>6|(n/4&12)),s<'25'?g(n>>4,d='0125')+`:${g(n&15)} - ${s}
`:'')+f(n+1):''

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Charcoal, 59 bytes

F012F0125F0125F015¿›‹⁺ικ25⁼⁺λμ25«ικ:λμ - F⟦μλ3κι⟧§015::2Iν⸿

Try it online! Link is to verbose version of code. Explanation:

F012F0125F0125F015

Create four nested loops for the unmirrored digits.

¿›‹⁺ικ25⁼⁺λμ25«

Check that neither the hours nor minutes is 25. (Mirroring the 25 minutes will result in 25 hours, so that's a no-go.)

ικ:λμ - 

Print the unmirrored time.

F⟦μλ3κι⟧§015::2Iν⸿

Print the mirrored time by converting the reversed digits (or 3 for the colon) from string to integer and looking them up in a translation table.

Alternatively, also for 59 bytes:

F¹¹F¹⁶¿⁻¹¹κ¿⁻²﹪κ⁴«≔⟦÷ι⁴﹪ι⁴¦⁴÷κ⁴﹪κ⁴⟧θFθ§0125:λ - F⮌θ§0152:λ⸿

Try it online! Link is to verbose version of code. Explanation:

F¹¹F¹⁶

Create loops for the hours and minutes.

¿⁻¹¹κ¿⁻²﹪κ⁴«

Exclude 25 and also any minutes ending in 2.

≔⟦÷ι⁴﹪ι⁴¦⁴÷κ⁴﹪κ⁴⟧θ

Convert the hours and minutes to base 4.

Fθ§0125:λ

Print the digits looked up in a translation table.

 - 

Print the separator.

F⮌θ§0152:λ⸿

Print the reversed digits looked up in a mirrored translation table.

\$\endgroup\$
1
\$\begingroup\$

Jelly, 72 66 62 55 bytes

®ṢiЀUị®
“0152:”©ṢṖp`⁺ḣ176j€“:”µ;"Ç€⁾25ẇ$ÐṂœs€2j€“ - ”Y

Try it online!

Niladic program. I got the double product of '0125' idea from the 05AB1E answer by Emigna but the rest I did without consulting that since the languages diverge after that. There are probably opportunities for golfing, possibly by a lot.

Explanation

The program works as follows:

  • Take all products of length four of the list of characters '0125' with “0152:”©ṢṖp`⁺. © copies the string '0152:' to the register for use later. ṢṖ sorts then pops the last element of the string → '0125'. duplicates the product link.

  • ḣ176 removes any times with format 25xx or 5xxx (not valid hours).

  • j€“:” joins each pair of digits with a ':'. e.g. ['05'],['21']]'05:12'.

  • Ç€ applies the first link to each of these times. It finds the index of each character in the string '0125:' then for each of those indices gets the character in the string '0152:' and reverses it. This is the mirror operation (reversing and swapping 2s and 5s).

  • µ;" concatenates the original time with the mirrored time → '05:2115:20'

  • ⁾25ẇ$ÐṂ filters out the times with the substring '25'. This catches any time pairs with mirrored half 25:xx or 5x:xx. Note: I don't know why the $ is necessary. Perhaps someone could golf it out with the proper syntax but I'm not sure.

  • Split each of these times into two halves (œs€2) then join them with the string ' - ' (j€“ - ”). '05:2115:20''05:21 - 15:20'.

  • Finally, Y joins all the strings with a newline and everything is implicitly printed.

Old versions

62 bytes

i@€®ị“:0152”
“:0125”©Ḋp`⁺ḣ176j€“:”µ,"UÇ€$F€⁾25ẇ$ÐṂœs€2j€“ - ”Y

Try it online!

66 bytes

“0125”
i@€¢ị“0152”
UṚÇ€
Ñp`⁺ḣ176µ,"Ç€j€€“:”j€“ - ”¹⁾2 ẇ$ÐṂ⁾25ẇ$ÐṂY

Try it online!

72 bytes

⁾25
i@€¢µẋ@€¢ṙ"
Ṛµ;@""Ç€Ḣ€€
“0125”p`⁺j€“:”ḣ176µ,"Ç€j€“ - ”¹⁾2 ẇ$ÐṂÑẇ$ÐṂY

Try it online!

\$\endgroup\$
1
\$\begingroup\$

C (gcc), 175 174 bytes

One off thanks to @Steadybox.

char*p,s[14],*e;f(t){for(t=0;sprintf(p=s,"%02d:%02d -",t/100,t%100),t<2400;)if(t++%10^2&&!strpbrk(s,"346789")&&t%100^26){for(e=s+12;p<e;p++)*e--=*p^7*(*p>49&*p<58);puts(s);}}

Try it online!

\$\endgroup\$
0
1
\$\begingroup\$

Befunge, 178 bytes

>0>:5g"7"`>v1\,+55<
v_^#`+87:+1_4>99p\ :99gg48 *-:55+/"0"+,55+%"0"+,":",\v
>$1+:55v v,," - "_^#-5g99,+"0"%+55,+"0"/+55:-*84gg99:<
v_@#!`+< >,\5^
 !"%*+,/4569RSTW
 *R4!+S5%/W9",T6

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Kotlin, 205 207 bytes

(0..1439).map{"%02d : %02d".format(it/60,it%60)}.let{it.map{i->i to i.reversed().map{x->"25180:X52180:".let{it[it.indexOf(x)+7]}}.joinToString("")}.filter{(_,b)->it.contains(b)}.map{(a,b)->println("$a-$b")}}

Beautified

    (0..1439)
        .map { "%02d : %02d".format(it / 60, it % 60) }              // Make the times
        .let { it.map {i->
                i to i.reversed().map {x->                         // Pair it with the reversed times
                    "25180:X52180:".let{ it[it.indexOf(x)+7] }     // - X means bad times are removed
                }.joinToString("")                                 // - Make the string
            }.filter {(_,b)-> it.contains(b) }                     // Remove the unpaired times
                .map { (a, b) -> println("$a - $b") }              // Print out the pairs
        }

Test

fun main(args: Array<String>) {
    f()
}

fun f() =
(0..1439).map{"%02d:%02d".format(it/60,it%60)}.let{it.map{i->i to i.reversed().map{x->"25180:X52180:".let{it[it.indexOf(x)+7]}}.joinToString("")}.filter{(_,b)->it.contains(b)}.map{(a,b)->println("$a-$b")}}

TIO

TryItOnline

Edits

\$\endgroup\$
2
  • \$\begingroup\$ There's supposed to be a space on both sides of the -. Costs only two bytes to add: Try it online! \$\endgroup\$
    – Steadybox
    Feb 4, 2018 at 13:20
  • \$\begingroup\$ Fixed, I wonder if there is a way to get back to 205 bytes reducing the rest of the code \$\endgroup\$
    – jrtapsell
    Feb 4, 2018 at 13:24
1
\$\begingroup\$

Deadfish~, 9627 bytes

{iiiii}ddcc{i}c{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}c{d}cc{dddd}iic{iiii}ddcc{i}c{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}c{d}cc{dddd}iic{iiii}ddcc{i}c{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}c{d}cc{dddd}iic{iiii}ddcc{i}c{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dc{d}cc{dddd}iic{iiii}ddcc{i}c{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dc{d}cc{dddd}iic{iiii}ddcc{i}c{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dc{d}cc{dddd}iic{iiii}ddcc{i}c{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiic{d}cc{dddd}iic{iiii}ddcc{i}c{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiic{d}cc{dddd}iic{iiii}ddcc{i}cdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddc{d}cc{dddd}iic{iiii}ddcc{i}cdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddc{d}cc{dddd}iic{iiii}ddcc{i}cdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddc{d}cc{dddd}iic{iiii}ddcic{i}dc{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}c{d}icdc{dddd}iic{iiii}ddcic{i}dc{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}c{d}icdc{dddd}iic{iiii}ddcic{i}dc{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}c{d}icdc{dddd}iic{iiii}ddcic{i}dc{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dc{d}icdc{dddd}iic{iiii}ddcic{i}dc{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dc{d}icdc{dddd}iic{iiii}ddcic{i}dc{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dc{d}icdc{dddd}iic{iiii}ddcic{i}dc{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiic{d}icdc{dddd}iic{iiii}ddcic{i}dc{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiic{d}icdc{dddd}iic{iiii}ddcic{i}dcdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddc{d}icdc{dddd}iic{iiii}ddcic{i}dcdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddc{d}icdc{dddd}iic{iiii}ddcic{i}dcdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddc{d}icdc{dddd}iic{iiii}ddciic{i}ddc{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}cdddddcdddddc{dddd}iic{iiii}ddciic{i}ddc{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}cdddddcdddddc{dddd}iic{iiii}ddciic{i}ddc{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}cdddddcdddddc{dddd}iic{iiii}ddciic{i}ddc{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dcdddddcdddddc{dddd}iic{iiii}ddciic{i}ddc{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dcdddddcdddddc{dddd}iic{iiii}ddciic{i}ddc{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dcdddddcdddddc{dddd}iic{iiii}ddciic{i}ddc{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiicdddddcdddddc{dddd}iic{iiii}ddciic{i}ddc{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiicdddddcdddddc{dddd}iic{iiii}ddciic{i}ddcdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddcdddddcdddddc{dddd}iic{iiii}ddciic{i}ddcdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddcdddddcdddddc{dddd}iic{iiii}ddciic{i}ddcdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddcdddddcdddddc{dddd}iic{iiii}ddciiiiiciiiiic{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}c{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiic{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}c{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiic{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}c{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiic{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dc{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiic{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dc{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiic{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dc{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiic{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiic{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiic{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiic{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiicdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddc{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiicdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddc{d}iicddc{dddd}iic{iiii}ddciiiiiciiiiicdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddc{d}iicddc{dddd}iic{iiii}dcdc{i}c{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}c{d}cic{dddd}ic{iiii}dcdc{i}c{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}c{d}cic{dddd}ic{iiii}dcdc{i}c{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}c{d}cic{dddd}ic{iiii}dcdc{i}c{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dc{d}cic{dddd}ic{iiii}dcdc{i}c{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dc{d}cic{dddd}ic{iiii}dcdc{i}c{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dc{d}cic{dddd}ic{iiii}dcdc{i}c{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiic{d}cic{dddd}ic{iiii}dcdc{i}c{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiic{d}cic{dddd}ic{iiii}dcdc{i}cdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddc{d}cic{dddd}ic{iiii}dcdc{i}cdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddc{d}cic{dddd}ic{iiii}dcdc{i}cdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddc{d}cic{dddd}ic{iiii}dcc{i}dc{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}c{d}icc{dddd}ic{iiii}dcc{i}dc{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}c{d}icc{dddd}ic{iiii}dcc{i}dc{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}c{d}icc{dddd}ic{iiii}dcc{i}dc{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dc{d}icc{dddd}ic{iiii}dcc{i}dc{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dc{d}icc{dddd}ic{iiii}dcc{i}dc{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dc{d}icc{dddd}ic{iiii}dcc{i}dc{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiic{d}icc{dddd}ic{iiii}dcc{i}dc{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiic{d}icc{dddd}ic{iiii}dcc{i}dcdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddc{d}icc{dddd}ic{iiii}dcc{i}dcdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddc{d}icc{dddd}ic{iiii}dcc{i}dcdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddc{d}icc{dddd}ic{iiii}dcic{i}ddc{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}cdddddcddddc{dddd}ic{iiii}dcic{i}ddc{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}cdddddcddddc{dddd}ic{iiii}dcic{i}ddc{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}cdddddcddddc{dddd}ic{iiii}dcic{i}ddc{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dcdddddcddddc{dddd}ic{iiii}dcic{i}ddc{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dcdddddcddddc{dddd}ic{iiii}dcic{i}ddc{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dcdddddcddddc{dddd}ic{iiii}dcic{i}ddc{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiicdddddcddddc{dddd}ic{iiii}dcic{i}ddc{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiicdddddcddddc{dddd}ic{iiii}dcic{i}ddcdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddcdddddcddddc{dddd}ic{iiii}dcic{i}ddcdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddcdddddcddddc{dddd}ic{iiii}dcic{i}ddcdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddcdddddcddddc{dddd}ic{iiii}dciiiiciiiiic{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}c{d}iicdc{dddd}ic{iiii}dciiiiciiiiic{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}c{d}iicdc{dddd}ic{iiii}dciiiiciiiiic{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}c{d}iicdc{dddd}ic{iiii}dciiiiciiiiic{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dc{d}iicdc{dddd}ic{iiii}dciiiiciiiiic{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dc{d}iicdc{dddd}ic{iiii}dciiiiciiiiic{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dc{d}iicdc{dddd}ic{iiii}dciiiiciiiiic{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiic{d}iicdc{dddd}ic{iiii}dciiiiciiiiic{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiic{d}iicdc{dddd}ic{iiii}dciiiiciiiiicdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddc{d}iicdc{dddd}ic{iiii}dciiiiciiiiicdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddc{d}iicdc{dddd}ic{iiii}dciiiiciiiiicdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddc{d}iicdc{dddd}ic{iiii}cddc{i}c{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}c{d}ciiiiic{dddd}dddc{iiii}cddc{i}c{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}c{d}ciiiiic{dddd}dddc{iiii}cddc{i}c{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}c{d}ciiiiic{dddd}dddc{iiii}cddc{i}c{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dc{d}ciiiiic{dddd}dddc{iiii}cddc{i}c{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dc{d}ciiiiic{dddd}dddc{iiii}cddc{i}c{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dc{d}ciiiiic{dddd}dddc{iiii}cddc{i}c{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiic{d}ciiiiic{dddd}dddc{iiii}cddc{i}c{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiic{d}ciiiiic{dddd}dddc{iiii}cddc{i}cdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddc{d}ciiiiic{dddd}dddc{iiii}cddc{i}cdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddc{d}ciiiiic{dddd}dddc{iiii}cddc{i}cdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddc{d}ciiiiic{dddd}dddc{iiii}cdc{i}dc{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}c{d}iciiiic{dddd}dddc{iiii}cdc{i}dc{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}c{d}iciiiic{dddd}dddc{iiii}cdc{i}dc{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}c{d}iciiiic{dddd}dddc{iiii}cdc{i}dc{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dc{d}iciiiic{dddd}dddc{iiii}cdc{i}dc{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dc{d}iciiiic{dddd}dddc{iiii}cdc{i}dc{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dc{d}iciiiic{dddd}dddc{iiii}cdc{i}dc{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiic{d}iciiiic{dddd}dddc{iiii}cdc{i}dc{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiic{d}iciiiic{dddd}dddc{iiii}cdc{i}dcdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddc{d}iciiiic{dddd}dddc{iiii}cdc{i}dcdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddc{d}iciiiic{dddd}dddc{iiii}cdc{i}dcdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddc{d}iciiiic{dddd}dddc{iiii}cc{i}ddc{d}cc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicc{i}cdddddcc{dddd}dddc{iiii}cc{i}ddc{d}cic{dd}iiic{i}iiic{d}dddc{ii}dddcdc{i}cdddddcc{dddd}dddc{iiii}cc{i}ddc{d}ciiiiic{dd}dc{i}iiic{d}dddc{ii}ddcddc{i}cdddddcc{dddd}dddc{iiii}cc{i}ddc{d}icdc{d}ddddddc{i}iiic{d}dddc{i}iiiiiicic{i}dcdddddcc{dddd}dddc{iiii}cc{i}ddc{d}icc{dd}iiic{i}iiic{d}dddc{ii}dddcc{i}dcdddddcc{dddd}dddc{iiii}cc{i}ddc{d}iciiiic{dd}dc{i}iiic{d}dddc{ii}ddcdc{i}dcdddddcc{dddd}dddc{iiii}cc{i}ddc{d}iicddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciiiiiciiiiicdddddcc{dddd}dddc{iiii}cc{i}ddc{d}iicdc{dd}iiic{i}iiic{d}dddc{ii}dddciiiiciiiiicdddddcc{dddd}dddc{iiii}cc{i}ddcdddddcdddddc{d}ddddddc{i}iiic{d}dddc{i}iiiiiiciic{i}ddcdddddcc{dddd}dddc{iiii}cc{i}ddcdddddcddddc{dd}iiic{i}iiic{d}dddc{ii}dddcic{i}ddcdddddcc{dddd}dddc{iiii}cc{i}ddcdddddcc{dd}dc{i}iiic{d}dddc{ii}ddcc{i}ddcdddddcc
\$\endgroup\$
0
\$\begingroup\$

C, 225 bytes

h,m,l,r,d=10,L[]={0,1,5,9,9,2,9,9,8,9};M(h,m){l=L[h%d]*d+L[h/d];r=L[m%d]*d+L[m/d];return L[h%d]<9&L[h/d]<9&L[m%d]<9&L[m/d]<9;}f(){for(h=0;h<24;++h)for(m=0;m<60;++m)M(h,m)&l<60&r<24&&printf("%02d:%02d - %02d:%02d\n",h,m,r,l);}

Since there is no C answer, I post my own. Some other approach might be shorter.

Try it online!

\$\endgroup\$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.