4 <meta charset=
"utf-8"/>
5 <title>Day
14 - Advent of Code
</title>
6 <!--[if lt IE 9]><script src="/static/html5.js"></script><![endif]-->
7 <link href='//fonts.googleapis.com/css?family=Source+Code+Pro:
300&subset=latin,latin-ext' rel='stylesheet' type='text/css'
>
8 <link rel=
"stylesheet" type=
"text/css" href=
"/static/style.css?3"/>
9 <link rel=
"shortcut icon" href=
"/favicon.ico?2"/>
15 Oh, hello! Funny seeing you here.
17 I appreciate your enthusiasm, but you aren't going to find much down here.
18 There certainly aren't clues to any of the puzzles. You do risk spoiling a few
19 surprises for yourself, though. Best to play the normal way and discover
20 everything as it was intended, I think. The best surprises don't even appear
21 in the source until you unlock them for real.
23 Please be careful with automated requests; I'm not Google, and I can only take
24 so much traffic. Please be considerate so that everyone gets to play.
26 If you're curious about how Advent of Code works, it's running on some custom
27 Perl code. Other than a few integrations (auth, analytics, ads, social media),
28 I built the whole thing myself, including the design, animations, prose, and
31 The puzzles probably took the longest; the easiest ones were around 45 minutes
32 each, but the harder ones took 2-3 hours, some even longer than that. A lot of
33 effort went into building this thing - I hope you're enjoying playing it as
34 much as I enjoyed making it for you!
36 If you'd like to hang out, I'm @ericwastl on Twitter.
91 <header><h1><a href=
"/">Advent of Code
</a></h1><div class=
"user">Neil Smith
<span class=
"star-count">28*
</span></div><nav><ul><li><a href=
"/about">[About]
</a></li><li><a href=
"/stats">[Stats]
</a></li><li><a href=
"/leaderboard">[Leaderboard]
</a></li><li><a href=
"/settings">[Settings]
</a></li><li><a href=
"/auth/logout">[Log out]
</a></li></ul></nav></header>
94 <script async
src=
"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
95 <!-- Advent of Code Wide Skyscraper -->
96 <ins class=
"adsbygoogle"
97 style=
"display:inline-block;width:160px;height:600px"
98 data-ad-client=
"ca-pub-9420604735624631"
99 data-ad-slot=
"8014013294"></ins>
101 (adsbygoogle = window.adsbygoogle || []).push({});
106 <article class=
"day-desc"><h2>--- Day
14: Reindeer Olympics ---
</h2><p>This year is the Reindeer Olympics! Reindeer can fly at high speeds, but must rest occasionally to recover their energy. Santa would like to know which of his reindeer is fastest, and so he has them race.
</p>
107 <p>Reindeer can only either be
<em>flying
</em> (always at their top speed) or
<em>resting
</em> (not moving at all), and always spend whole seconds in either state.
</p>
108 <p>For example, suppose you have the following Reindeer:
</p>
110 <li>Comet can fly
<em>14 km/s for
10 seconds
</em>, but then must rest for
<em>127 seconds
</em>.
</li>
111 <li>Dancer can fly
<em>16 km/s for
11 seconds
</em>, but then must rest for
<em>162 seconds
</em>.
</li>
113 <p>After one second, Comet has gone
14 km, while Dancer has gone
16 km. After ten seconds, Comet has gone
140 km, while Dancer has gone
160 km. On the eleventh second, Comet begins resting (staying at
140 km), and Dancer continues on for a total distance of
176 km. On the
12th second, both reindeer are resting. They continue to rest until the
138th second, when Comet flies for another ten seconds. On the
174th second, Dancer flies for another
11 seconds.
</p>
114 <p>In this example, after the
1000th second, both reindeer are resting, and Comet is in the lead at
<em><code>1120</code></em> km (poor Dancer has only gotten
<code>1056</code> km by that point). So, in this situation, Comet would win (if the race ended at
1000 seconds).
</p>
115 <p>Given the descriptions of each reindeer (in your puzzle input), after exactly
<code>2503</code> seconds,
<em>what distance has the winning reindeer traveled
</em>?
</p>
117 <p>Your puzzle answer was
<code>2655</code>.
</p><article class=
"day-desc"><h2>--- Part Two ---
</h2><p>Seeing how reindeer move in bursts, Santa decides he's not pleased with the old scoring system.
</p>
118 <p>Instead, at the end of each second, he awards one point to the reindeer currently in the lead. (If there are multiple reindeer tied for the lead, they each get one point.) He keeps the traditional
2503 second time limit, of course, as doing otherwise would be
<span title=
"It also risks choosing a duration that isn't coprime with the cycle times of each reindeer.">entirely ridiculous
</span>.
</p>
119 <p>Given the example reindeer from above, after the first second, Dancer is in the lead and gets one point. He stays in the lead until several seconds into Comet's second burst: after the
140th second, Comet pulls into the lead and gets his first point. Of course, since Dancer had been in the lead for the
139 seconds before that, he has accumulated
139 points by the
140th second.
</p>
120 <p>After the
1000th second, Dancer has accumulated
<em><code>689</code></em> points, while poor Comet, our old champion, only has
<code>312</code>. So, with the new scoring system, Dancer would win (if the race ended at
1000 seconds).
</p>
121 <p>Again given the descriptions of each reindeer (in your puzzle input), after exactly
<code>2503</code> seconds,
<em>how many points does the winning reindeer have
</em>?
</p>
123 <p>Your puzzle answer was
<code>1059</code>.
</p><p class=
"day-success">Both parts of this puzzle are complete! They provide two gold stars: **
</p>
124 <p>At this point, you should
<a href=
"/">return to your advent calendar
</a> and try another puzzle.
</p>
125 <p>If you still want to see it, you can
<a href=
"/day/14/input" target=
"_blank">get your puzzle input
</a>.
</p>
126 <p>You can also
<span class=
"share">[Share
<span class=
"share-content">on
127 <a href=
"https://twitter.com/intent/tweet?text=I%27ve+completed+%22Reindeer+Olympics%22+%2D+Day+14+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F14&related=ericwastl&hashtags=AdventOfCode" target=
"_blank">Twitter
</a>
128 <a href=
"https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F14" target=
"_blank">Google+
</a>
129 <a href=
"http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F14&title=I%27ve+completed+%22Reindeer+Olympics%22+%2D+Day+14+%2D+Advent+of+Code" target=
"_blank">Reddit
</a
136 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
137 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=
1*new Date();a=s.createElement(o),
138 m=s.getElementsByTagName(o)[
0];a.async=
1;a.src=g;m.parentNode.insertBefore(a,m)
139 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
140 ga('create', 'UA-
69522494-
1', 'auto');
141 ga('send', 'pageview');