aoc-2021-rust

Advent of Code 2021 Solutions in Rust
git clone https://git.sinitax.com/sinitax/aoc-2021-rust
Log | Files | Refs | README | sfeed.txt

part2 (1549B)


      1--- Part Two ---
      2
      3Through a little deduction, you should now be able to determine the remaining digits. Consider again
      4the first example above:
      5
      6acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab |
      7cdfeb fcadb cdfeb cdbaf
      8After some careful analysis, the mapping between signal wires and segments only make sense in the
      9following configuration:
     10
     11 dddd
     12e    a
     13e    a
     14 ffff
     15g    b
     16g    b
     17 cccc
     18
     19So, the unique signal patterns would correspond to the following digits:
     20
     21
     22 - acedgfb: 8
     23
     24 - cdfbe: 5
     25
     26 - gcdfa: 2
     27
     28 - fbcad: 3
     29
     30 - dab: 7
     31
     32 - cefabd: 9
     33
     34 - cdfgeb: 6
     35
     36 - eafb: 4
     37
     38 - cagedb: 0
     39
     40 - ab: 1
     41
     42
     43Then, the four digits of the output value can be decoded:
     44
     45
     46 - cdfeb: 5
     47
     48 - fcadb: 3
     49
     50 - cdfeb: 5
     51
     52 - cdbaf: 3
     53
     54
     55Therefore, the output value for this entry is 5353.
     56
     57Following this same process for each entry in the second, larger example above, the output value of
     58each entry can be determined:
     59
     60
     61 - fdgacbe cefdb cefbgd gcbe: 8394
     62
     63 - fcgedb cgb dgebacf gc: 9781
     64
     65 - cg cg fdcagb cbg: 1197
     66
     67 - efabcd cedba gadfec cb: 9361
     68
     69 - gecf egdcabf bgf bfgea: 4873
     70
     71 - gebdcfa ecba ca fadegcb: 8418
     72
     73 - cefg dcbef fcge gbcadfe: 4548
     74
     75 - ed bcgafe cdgba cbgef: 1625
     76
     77 - gbdfcae bgc cg cgb: 8717
     78
     79 - fgae cfgab fg bagce: 4315
     80
     81
     82Adding all of the output values in this larger example produces 61229.
     83
     84For each entry, determine all of the wire/segment connections and decode the four-digit output
     85values. What do you get if you add up all of the output values?
     86
     87