aboutsummaryrefslogtreecommitdiffstats
path: root/src/16/part2
blob: 71dfbaf18701e7ba9e4d61036a4c80429a077deb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- Part Two ---

Now that you've identified which tickets contain invalid values, discard those tickets
entirely. Use the remaining valid tickets to determine which field is which.

Using the valid ranges for each field, determine what order the fields appear on the tickets. The
order is consistent between all tickets: if seat is the third field, it is the third field on every
ticket, including your ticket.

For example, suppose you have the following notes:

class: 0-1 or 4-19
row: 0-5 or 8-19
seat: 0-13 or 16-19

your ticket:
11,12,13

nearby tickets:
3,9,18
15,1,5
5,14,9

Based on the nearby tickets in the above example, the first position must be row, the
second position must be class, and the third position must be seat; you can conclude that in
your ticket, class is 12, row is 11, and seat is 13.

Once you work out which field is which, look for the six fields on your ticket that
start with the word departure. What do you get if you multiply those six values
together?