Reflowed problems and added solutions

This commit is contained in:
2018-03-15 11:24:23 -05:00
parent 986d17f104
commit 2a37946673
50 changed files with 2124 additions and 1464 deletions

View File

@@ -1,26 +1,20 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- Day 13: Knights of the Dinner Table ---
In years past, the holiday feast with your family hasn't gone so well. Not everyone gets along!
This year, you resolve, will be different. You're going to find the optimal seating arrangement
and avoid all those awkward conversations.
In years past, the holiday feast with your family hasn't gone so well. Not
everyone gets along! This year, you resolve, will be different. You're going
to find the optimal seating arrangement and avoid all those awkward
conversations.
You start by writing up a list of everyone invited and the amount their happiness would
increase or decrease if they were to find themselves sitting next to each other person. You
have a circular table that will be just big enough to fit everyone comfortably, and so each
person will have exactly two neighbors.
You start by writing up a list of everyone invited and the amount their
happiness would increase or decrease if they were to find themselves sitting
next to each other person. You have a circular table that will be just big
enough to fit everyone comfortably, and so each person will have exactly two
neighbors.
For example, suppose you have only four attendees planned, and you calculate their potential
happiness as follows:
For example, suppose you have only four attendees planned, and you calculate
their potential happiness as follows:
Alice would gain 54 happiness units by sitting next to Bob.
Alice would lose 79 happiness units by sitting next to Carol.
@@ -35,13 +29,14 @@
David would lose 7 happiness units by sitting next to Bob.
David would gain 41 happiness units by sitting next to Carol.
Then, if you seat Alice next to David, Alice would lose 2 happiness units (because David talks
so much), but David would gain 46 happiness units (because Alice is such a good listener), for
a total change of 44.
Then, if you seat Alice next to David, Alice would lose 2 happiness units
(because David talks so much), but David would gain 46 happiness units
(because Alice is such a good listener), for a total change of 44.
If you continue around the table, you could then seat Bob next to Alice (Bob gains 83, Alice
gains 54). Finally, seat Carol, who sits next to Bob (Carol gains 60, Bob loses 7) and David
(Carol gains 55, David gains 41). The arrangement looks like this:
If you continue around the table, you could then seat Bob next to Alice (Bob
gains 83, Alice gains 54). Finally, seat Carol, who sits next to Bob (Carol
gains 60, Bob loses 7) and David (Carol gains 55, David gains 41). The
arrangement looks like this:
+41 +46
+55 David -2
@@ -49,37 +44,37 @@
+60 Bob +54
-7 +83
After trying every other seating arrangement in this hypothetical scenario, you find that this
one is the most optimal, with a total change in happiness of 330.
After trying every other seating arrangement in this hypothetical scenario,
you find that this one is the most optimal, with a total change in happiness
of 330.
What is the total change in happiness for the optimal seating arrangement of the actual guest
list?
What is the total change in happiness for the optimal seating arrangement of
the actual guest list?
Your puzzle answer was 733.
--- Part Two ---
In all the commotion, you realize that you forgot to seat yourself. At this point, you're
pretty apathetic toward the whole thing, and your happiness wouldn't really go up or down
regardless of who you sit next to. You assume everyone else would be just as ambivalent about
sitting next to you, too.
In all the commotion, you realize that you forgot to seat yourself. At this
point, you're pretty apathetic toward the whole thing, and your happiness
wouldn't really go up or down regardless of who you sit next to. You assume
everyone else would be just as ambivalent about sitting next to you, too.
So, add yourself to the list, and give all happiness relationships that involve you a score of
0.
So, add yourself to the list, and give all happiness relationships that
involve you a score of 0.
What is the total change in happiness for the optimal seating arrangement that actually
includes yourself?
What is the total change in happiness for the optimal seating arrangement
that actually includes yourself?
Your puzzle answer was 725.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@@ -91,6 +86,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/13/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Knights+of+the+Dinner+Table%22+%2D+Day+13+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F13&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F13
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F13&title=I%27ve+completed+%22Knights+of+the+Dinner+Table%22+%2D+Day+13+%2D+Advent+of+Code