Log in to get your input and submit your answers.
Day 16: Ticket Translation
To finalize the exam paperwork, the Bocal tasks you with verifying students' summary tickets. But the printer glitched again: the column headers are missing, leaving only comma-separated numbers on every ticket!
Fortunately, the Bocal preserved the validation rules for each field, where each rule permits two distinct valid ranges.
Your puzzle input is divided into three sections separated by blank lines:
- The list of field rules (e.g.
exam note: 20-30 or 700-800). - The values of your ticket (
your ticket:). - The values of nearby tickets (
nearby tickets:).
Part 1
Some nearby tickets contain completely corrupted numbers that do not fit into any valid range of any field.
First, compute your ticket scanning error rate: sum all values on nearby tickets that are not valid for any of the rules in your input.
Example
Consider this small test dataset:
class: 1-3 or 5-7
row: 6-11 or 33-44
seat: 13-40 or 45-50
your ticket:
7,1,14
nearby tickets:
7,3,47
40,4,50
55,2,20
38,6,12In this sample, looking at the nearby tickets:
- On the 2nd ticket, the number
4is not valid for any field. - On the 3rd ticket, the number
55is not valid for any field. - On the 4th ticket, the number
12is not valid for any field.
The ticket scanning error rate is: 4 + 55 + 12 = 71.
Scan the nearby tickets in your input. What is your ticket scanning error rate?