2016-12-20 17:05:43 +00:00
|
|
|
Advent of Code
|
|
|
|
|
|
|
|
--- Day 20: Firewall Rules ---
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
You'd like to set up a small hidden computer here so you can use it to get
|
|
|
|
back into the network later. However, the corporate firewall only allows
|
|
|
|
communication with certain external IP addresses.
|
2016-12-20 17:05:43 +00:00
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
You've retrieved the list of blocked IPs from the firewall, but the list
|
|
|
|
seems to be messy and poorly maintained, and it's not clear which IPs are
|
|
|
|
allowed. Also, rather than being written in dot-decimal notation, they are
|
|
|
|
written as plain 32-bit integers, which can have any value from 0 through
|
|
|
|
4294967295, inclusive.
|
2016-12-20 17:05:43 +00:00
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
For example, suppose only the values 0 through 9 were valid, and that you
|
|
|
|
retrieved the following blacklist:
|
2016-12-20 17:05:43 +00:00
|
|
|
|
|
|
|
5-8
|
|
|
|
0-2
|
|
|
|
4-7
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
The blacklist specifies ranges of IPs (inclusive of both the start and end
|
|
|
|
value) that are not allowed. Then, the only IPs that this firewall allows
|
|
|
|
are 3 and 9, since those are the only numbers not in any range.
|
2016-12-20 17:05:43 +00:00
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
Given the list of blocked IPs you retrieved from the firewall (your puzzle
|
|
|
|
input), what is the lowest-valued IP that is not blocked?
|
2016-12-20 17:05:43 +00:00
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
Your puzzle answer was 31053880.
|
2016-12-20 17:05:43 +00:00
|
|
|
|
|
|
|
--- Part Two ---
|
|
|
|
|
|
|
|
How many IPs are allowed by the blacklist?
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
Your puzzle answer was 117.
|
2016-12-20 17:05:43 +00:00
|
|
|
|
|
|
|
References
|
|
|
|
|
|
|
|
Visible links
|
|
|
|
. http://adventofcode.com/
|
|
|
|
. http://adventofcode.com/2016/about
|
|
|
|
. http://adventofcode.com/2016/support
|
|
|
|
. http://adventofcode.com/2016/events
|
|
|
|
. http://adventofcode.com/2016/settings
|
|
|
|
. http://adventofcode.com/2016/auth/logout
|
|
|
|
. http://adventofcode.com/2016
|
|
|
|
. http://adventofcode.com/2016
|
|
|
|
. http://adventofcode.com/2016/leaderboard
|
|
|
|
. http://adventofcode.com/2016/stats
|
|
|
|
. http://adventofcode.com/2016/sponsors
|
|
|
|
. http://adventofcode.com/2016/sponsors
|
|
|
|
. https://en.wikipedia.org/wiki/IPv4#Addressing
|
|
|
|
. https://en.wikipedia.org/wiki/Dot-decimal_notation
|
|
|
|
. https://en.wikipedia.org/wiki/32-bit
|
|
|
|
. http://adventofcode.com/2016
|
|
|
|
. http://adventofcode.com/2016/day/20/input
|