Done day 23
[advent-of-code-18.git] / problems / day23.html
diff --git a/problems/day23.html b/problems/day23.html
new file mode 100644 (file)
index 0000000..daea5d8
--- /dev/null
@@ -0,0 +1,163 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+<meta charset="utf-8"/>
+<title>Day 23 - Advent of Code 2018</title>
+<!--[if lt IE 9]><script src="/static/html5.js"></script><![endif]-->
+<link href='//fonts.googleapis.com/css?family=Source+Code+Pro:300&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
+<link rel="stylesheet" type="text/css" href="/static/style.css?20"/>
+<link rel="stylesheet alternate" type="text/css" href="/static/highcontrast.css?0" title="High Contrast"/>
+<link rel="shortcut icon" href="/favicon.png"/>
+</head><!--
+
+
+
+
+Oh, hello!  Funny seeing you here.
+
+I appreciate your enthusiasm, but you aren't going to find much down here.
+There certainly aren't clues to any of the puzzles.  The best surprises don't
+even appear in the source until you unlock them for real.
+
+Please be careful with automated requests; I'm not Google, and I can only take
+so much traffic.  Please be considerate so that everyone gets to play.
+
+If you're curious about how Advent of Code works, it's running on some custom
+Perl code. Other than a few integrations (auth, analytics, ads, social media),
+I built the whole thing myself, including the design, animations, prose, and
+all of the puzzles.
+
+The puzzles are most of the work; the easiest ones take 3-4 hours each, but the
+harder ones take 6-8 hours, and a few even longer than that. A lot of effort
+went into building this thing - I hope you're enjoying playing it as much as I
+enjoyed making it for you!
+
+If you'd like to hang out, I'm @ericwastl on Twitter.
+
+- Eric Wastl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-->
+<body>
+<header><div><h1 class="title-global"><a href="/">Advent of Code</a></h1><nav><ul><li><a href="/2018/about">[About]</a></li><li><a href="/2018/events">[Events]</a></li><li><a href="https://teespring.com/adventofcode-2019" target="_blank">[Shop]</a></li><li><a href="/2018/settings">[Settings]</a></li><li><a href="/2018/auth/logout">[Log Out]</a></li></ul></nav><div class="user">Neil Smith <a href="/2018/support" class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <span class="star-count">46*</span></div></div><div><h1 class="title-event">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">/^</span><a href="/2018">2018</a><span class="title-event-wrap">$/</span></h1><nav><ul><li><a href="/2018">[Calendar]</a></li><li><a href="/2018/support">[AoC++]</a></li><li><a href="/2018/sponsors">[Sponsors]</a></li><li><a href="/2018/leaderboard">[Leaderboard]</a></li><li><a href="/2018/stats">[Stats]</a></li></ul></nav></div></header>
+
+<div id="sidebar">
+<div id="sponsor"><div class="quiet">Our <a href="/2018/sponsors">sponsors</a> help make Advent of Code possible:</div><div class="sponsor"><a href="https://smartystreets.com/aoc" target="_blank" onclick="if(ga)ga('send','event','sponsor','click',this.href);" rel="noopener">SmartyStreets</a> - Global address validation made by developers, for developers</div></div>
+</div><!--/sidebar-->
+
+<main>
+<article class="day-desc"><h2>--- Day 23: Experimental Emergency Teleportation ---</h2><p>Using your torch to search the darkness of the rocky cavern, you finally locate the man's friend: a small <em>reindeer</em>.</p>
+<p>You're not sure how it got so far in this cave.  It looks sick - too sick to walk - and too heavy for you to carry all the way back.  Sleighs won't be invented for another 1500 years, of course.</p>
+<p>The only option is <em>experimental emergency teleportation</em>.</p>
+<p>You hit the "experimental emergency teleportation" <span title="We've always had this button; we've just been too scared to press it.">button</span> on the device and push <em>I accept the risk</em> on no fewer than 18 different warning messages. Immediately, the device deploys hundreds of tiny <em>nanobots</em> which fly around the cavern, apparently assembling themselves into a very specific <em>formation</em>. The device lists the <code>X,Y,Z</code> position (<code>pos</code>) for each nanobot as well as its <em>signal radius</em> (<code>r</code>) on its tiny screen (your puzzle input).</p>
+<p>Each nanobot can transmit signals to any integer coordinate which is a distance away from it <em>less than or equal to</em> its signal radius (as measured by <a href="https://en.wikipedia.org/wiki/Taxicab_geometry">Manhattan distance</a>). Coordinates a distance away of less than or equal to a nanobot's signal radius are said to be <em>in range</em> of that nanobot.</p>
+<p>Before you start the teleportation process, you should determine which nanobot is the <em>strongest</em> (that is, which has the largest signal radius) and then, for that nanobot, the <em>total number of nanobots that are in range</em> of it, <em>including itself</em>.</p>
+<p>For example, given the following nanobots:</p>
+<pre><code>pos=&lt;0,0,0&gt;, r=4
+pos=&lt;1,0,0&gt;, r=1
+pos=&lt;4,0,0&gt;, r=3
+pos=&lt;0,2,0&gt;, r=1
+pos=&lt;0,5,0&gt;, r=3
+pos=&lt;0,0,3&gt;, r=1
+pos=&lt;1,1,1&gt;, r=1
+pos=&lt;1,1,2&gt;, r=1
+pos=&lt;1,3,1&gt;, r=1
+</code></pre>
+<p>The strongest nanobot is the first one (position <code>0,0,0</code>) because its signal radius, <code>4</code> is the largest. Using that nanobot's location and signal radius, the following nanobots are in or out of range:</p>
+<ul>
+<li>The nanobot at <code>0,0,0</code> is distance <code>0</code> away, and so it is <em>in range</em>.</li>
+<li>The nanobot at <code>1,0,0</code> is distance <code>1</code> away, and so it is <em>in range</em>.</li>
+<li>The nanobot at <code>4,0,0</code> is distance <code>4</code> away, and so it is <em>in range</em>.</li>
+<li>The nanobot at <code>0,2,0</code> is distance <code>2</code> away, and so it is <em>in range</em>.</li>
+<li>The nanobot at <code>0,5,0</code> is distance <code>5</code> away, and so it is <em>not</em> in range.</li>
+<li>The nanobot at <code>0,0,3</code> is distance <code>3</code> away, and so it is <em>in range</em>.</li>
+<li>The nanobot at <code>1,1,1</code> is distance <code>3</code> away, and so it is <em>in range</em>.</li>
+<li>The nanobot at <code>1,1,2</code> is distance <code>4</code> away, and so it is <em>in range</em>.</li>
+<li>The nanobot at <code>1,3,1</code> is distance <code>5</code> away, and so it is <em>not</em> in range.</li>
+</ul>
+<p>In this example, in total, <code><em>7</em></code> nanobots are in range of the nanobot with the largest signal radius.</p>
+<p>Find the nanobot with the largest signal radius.  <em>How many nanobots are in range</em> of its signals?</p>
+</article>
+<p>Your puzzle answer was <code>510</code>.</p><article class="day-desc"><h2 id="part2">--- Part Two ---</h2><p>Now, you just need to figure out where to position yourself so that you're actually teleported when the nanobots activate.</p>
+<p>To increase the probability of success, you need to find the coordinate which puts you <em>in range of the largest number of nanobots</em>. If there are multiple, choose one <em>closest to your position</em> (<code>0,0,0</code>, measured by manhattan distance).</p>
+<p>For example, given the following nanobot formation:</p>
+<pre><code>pos=&lt;10,12,12&gt;, r=2
+pos=&lt;12,14,12&gt;, r=2
+pos=&lt;16,12,12&gt;, r=4
+pos=&lt;14,14,14&gt;, r=6
+pos=&lt;50,50,50&gt;, r=200
+pos=&lt;10,10,10&gt;, r=5
+</code></pre>
+<p>Many coordinates are in range of some of the nanobots in this formation.  However, only the coordinate <code>12,12,12</code> is in range of the most nanobots: it is in range of the first five, but is not in range of the nanobot at <code>10,10,10</code>. (All other coordinates are in range of fewer than five nanobots.) This coordinate's distance from <code>0,0,0</code> is <code><em>36</em></code>.</p>
+<p>Find the coordinates that are in range of the largest number of nanobots. <em>What is the shortest manhattan distance between any of those points and <code>0,0,0</code>?</em></p>
+</article>
+<p>Your puzzle answer was <code>108889300</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
+<p>At this point, you should <a href="/2018">return to your Advent calendar</a> and try another puzzle.</p>
+<p>If you still want to see it, you can <a href="23/input" target="_blank">get your puzzle input</a>.</p>
+<p>You can also <span class="share">[Share<span class="share-content">on
+  <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Experimental+Emergency+Teleportation%22+%2D+Day+23+%2D+Advent+of+Code+2018&amp;url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F23&amp;related=ericwastl&amp;hashtags=AdventOfCode" target="_blank">Twitter</a>
+  <a href="http://www.reddit.com/submit?url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F23&amp;title=I%27ve+completed+%22Experimental+Emergency+Teleportation%22+%2D+Day+23+%2D+Advent+of+Code+2018" target="_blank">Reddit</a
+></span>]</span> this puzzle.</p>
+</main>
+
+<!-- ga -->
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-69522494-1', 'auto');
+ga('set', 'anonymizeIp', true);
+ga('send', 'pageview');
+</script>
+<!-- /ga -->
+</body>
+</html>
\ No newline at end of file