aoc-2020-zig

Advent of Code 2020 Solutions in Zig
git clone https://git.sinitax.com/sinitax/aoc-2020-zig
Log | Files | Refs | README | sfeed.txt

part2 (1070B)


      1--- Part Two ---
      2
      3Now that you've identified which tickets contain invalid values, discard those tickets
      4entirely. Use the remaining valid tickets to determine which field is which.
      5
      6Using the valid ranges for each field, determine what order the fields appear on the tickets. The
      7order is consistent between all tickets: if seat is the third field, it is the third field on every
      8ticket, including your ticket.
      9
     10For example, suppose you have the following notes:
     11
     12class: 0-1 or 4-19
     13row: 0-5 or 8-19
     14seat: 0-13 or 16-19
     15
     16your ticket:
     1711,12,13
     18
     19nearby tickets:
     203,9,18
     2115,1,5
     225,14,9
     23
     24Based on the nearby tickets in the above example, the first position must be row, the
     25second position must be class, and the third position must be seat; you can conclude that in
     26your ticket, class is 12, row is 11, and seat is 13.
     27
     28Once you work out which field is which, look for the six fields on your ticket that
     29start with the word departure. What do you get if you multiply those six values
     30together?
     31
     32