Fix puzzle descriptions

This commit is contained in:
hedy 2022-12-04 18:42:40 +08:00
parent 62eb085026
commit 15da351fb3
Signed by: hedy
GPG Key ID: B51B5A8D1B176372
10 changed files with 179 additions and 27 deletions

View File

@ -1,5 +1,4 @@
\--- Day 6: Custom Customs ---
----------
# Day 6: Custom Customs
As your flight approaches the regional airport where you'll switch to a much larger plane, [customs declaration forms](https://en.wikipedia.org/wiki/Customs_declaration) are distributed to the passengers.
@ -11,7 +10,6 @@ However, the person sitting next to you seems to be experiencing a language barr
abcx
abcy
abcz
```
In this group, there are *`6`* questions to which anyone answered "yes": `a`, `b`, `c`, `x`, `y`, and `z`. (Duplicate answers to the same question don't count extra; each question counts at most once.)
@ -34,7 +32,6 @@ a
a
b
```
This list represents answers from five groups:
@ -49,12 +46,8 @@ In this example, the sum of these counts is `3 + 3 + 3 + 1 + 1` = *`11`*.
For each group, count the number of questions to which anyone answered "yes". *What is the sum of those counts?*
Your puzzle answer was `6680`.
The first half of this puzzle is complete! It provides one gold star: \*
\--- Part Two ---
----------
# Part Two
As you finish the last group's customs declaration, you notice that you misread one word in the instructions:
@ -78,7 +71,6 @@ a
a
b
```
This list represents answers from five groups:
@ -93,14 +85,3 @@ In this example, the sum of these counts is `3 + 0 + 1 + 1 + 1` = *`6`*.
For each group, count the number of questions to which *everyone* answered "yes". *What is the sum of those counts?*
Answer:
Although it hasn't changed, you can still [get your puzzle input](6/input).
You can also [Shareon [Twitter](https://twitter.com/intent/tweet?text=I%27ve+completed+Part+One+of+%22Custom+Customs%22+%2D+Day+6+%2D+Advent+of+Code+2020&url=https%3A%2F%2Fadventofcode%2Ecom%2F2020%2Fday%2F6&related=ericwastl&hashtags=AdventOfCode) [Mastodon](javascript:void(0);)] this puzzle.: \*\*
At this point, you should [return to your Advent calendar](/2020) and try another puzzle.
If you still want to see it, you can [get your puzzle input](5/input).
You can also [Shareon [Twitter](https://twitter.com/intent/tweet?text=I%27ve+completed+%22Binary+Boarding%22+%2D+Day+5+%2D+Advent+of+Code+2020&url=https%3A%2F%2Fadventofcode%2Ecom%2F2020%2Fday%2F5&related=ericwastl&hashtags=AdventOfCode) [Mastodon](javascript:void(0);)] this puzzle.

View File

@ -16,7 +16,6 @@ dark olive bags contain 3 faded blue bags, 4 dotted black bags.
vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.
faded blue bags contain no other bags.
dotted black bags contain no other bags.
```
These rules specify the required contents for 9 bag types. In this example, every `faded blue` bag is empty, every `vibrant plum` bag contains 11 bags (5 `faded blue` and 6 `dotted black`), and so on.
@ -32,6 +31,36 @@ In the above rules, the following options would be available to you:
So, in this example, the number of bag colors that can eventually contain at least one `shiny gold` bag is `*4*`.
*How many bag colors can eventually contain at least one `shiny gold` bag?*
*How many bag colors can eventually contain at least one `shiny gold` bag?* (The list of rules is quite long; make sure you get all of it.)
(The list of rules is quite long; make sure you get all of it.)
## Part Two
It's getting pretty expensive to fly these days - not because of ticket prices, but because of the ridiculous number of bags you need to buy!
Consider again your `shiny gold` bag and the rules from the above example:
* `faded blue` bags contain `0` other bags.
* `dotted black` bags contain `0` other bags.
* `vibrant plum` bags contain `11` other bags: 5 `faded blue` bags and 6 `dotted black` bags.
* `dark olive` bags contain `7` other bags: 3 `faded blue` bags and 4 `dotted black` bags.
So, a single `shiny gold` bag must contain 1 `dark olive` bag (and the 7 bags within it) plus 2 `vibrant plum` bags (and the 11 bags within *each* of those): `1 + 1*7 + 2 + 2*11` = `*32*` bags!
Of course, the actual rules have a small chance of going several levels deeper than this example; be sure to count all of the bags, even if the nesting becomes topologically impractical!
Here's another example:
```
shiny gold bags contain 2 dark red bags.
dark red bags contain 2 dark orange bags.
dark orange bags contain 2 dark yellow bags.
dark yellow bags contain 2 dark green bags.
dark green bags contain 2 dark blue bags.
dark blue bags contain 2 dark violet bags.
dark violet bags contain no other bags.
```
In this example, a single `shiny gold` bag must contain `*126*` other bags.
*How many individual bags are required inside your single `shiny gold` bag?*

54
2022/01/puzzle.md Normal file
View File

@ -0,0 +1,54 @@
# Day 1: Calorie Counting
Santa's reindeer typically eat regular reindeer food, but they need a lot of [magical energy](/2018/day/25) to deliver presents on Christmas. For that, their favorite snack is a special type of *star* fruit that only grows deep in the jungle. The Elves have brought you on their annual expedition to the grove where the fruit grows.
To supply enough magical energy, the expedition needs to retrieve a minimum of *fifty stars* by December 25th. Although the Elves assure you that the grove has plenty of fruit, you decide to grab any fruit you see along the way, just in case.
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants *one star*. Good luck!
The jungle must be too overgrown and difficult to navigate in vehicles or access from the air; the Elves' expedition traditionally goes on foot. As your boats approach land, the Elves begin taking inventory of their supplies. One important consideration is food - in particular, the number of *Calories* each Elf is carrying (your puzzle input).
The Elves take turns writing down the number of Calories contained by the various meals, snacks, rations, etc. that they've brought with them, one item per line. Each Elf separates their own inventory from the previous Elf's inventory (if any) by a blank line.
For example, suppose the Elves finish writing their items' Calories and end up with the following list:
```
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
```
This list represents the Calories of the food carried by five Elves:
* The first Elf is carrying food with `1000`, `2000`, and `3000` Calories, a total of `*6000*` Calories.
* The second Elf is carrying one food item with `*4000*` Calories.
* The third Elf is carrying food with `5000` and `6000` Calories, a total of `*11000*` Calories.
* The fourth Elf is carrying food with `7000`, `8000`, and `9000` Calories, a total of `*24000*` Calories.
* The fifth Elf is carrying one food item with `*10000*` Calories.
In case the Elves get hungry and need extra snacks, they need to know which Elf to ask: they'd like to know how many Calories are being carried by the Elf carrying the *most* Calories. In the example above, this is *`24000`* (carried by the fourth Elf).
Find the Elf carrying the most Calories. *How many total Calories is that Elf carrying?*
# Part Two
By the time you calculate the answer to the Elves' question, they've already realized that the Elf carrying the most Calories of food might eventually *run out of snacks*.
To avoid this unacceptable situation, the Elves would instead like to know the total Calories carried by the *top three* Elves carrying the most Calories. That way, even if one of those Elves runs out of snacks, they still have two backups.
In the example above, the top three Elves are the fourth Elf (with `24000` Calories), then the third Elf (with `11000` Calories), then the fifth Elf (with `10000` Calories). The sum of the Calories carried by these three elves is `*45000*`.
Find the top three Elves carrying the most Calories. *How many Calories are those Elves carrying in total?*

47
2022/02/puzzle.md Normal file
View File

@ -0,0 +1,47 @@
# Day 2: Rock Paper Scissors
The Elves begin to set up camp on the beach. To decide whose tent gets to be closest to the snack storage, a giant [Rock Paper Scissors](https://en.wikipedia.org/wiki/Rock_paper_scissors) tournament is already in progress.
Rock Paper Scissors is a game between two players. Each game contains many rounds; in each round, the players each simultaneously choose one of Rock, Paper, or Scissors using a hand shape. Then, a winner for that round is selected: Rock defeats Scissors, Scissors defeats Paper, and Paper defeats Rock. If both players choose the same shape, the round instead ends in a draw.
Appreciative of your help yesterday, one Elf gives you an *encrypted strategy guide* (your puzzle input) that they say will be sure to help you win. "The first column is what your opponent is going to play: `A` for Rock, `B` for Paper, and `C` for Scissors. The second column--" Suddenly, the Elf is called away to help with someone's tent.
The second column, you reason, must be what you should play in response: `X` for Rock, `Y` for Paper, and `Z` for Scissors. Winning every time would be suspicious, so the responses must have been carefully chosen.
The winner of the whole tournament is the player with the highest score. Your *total score* is the sum of your scores for each round. The score for a single round is the score for the *shape you selected* (1 for Rock, 2 for Paper, and 3 for Scissors) plus the score for the *outcome of the round* (0 if you lost, 3 if the round was a draw, and 6 if you won).
Since you can't be sure if the Elf is trying to help you or trick you, you should calculate the score you would get if you were to follow the strategy guide.
For example, suppose you were given the following strategy guide:
```
A Y
B X
C Z
```
This strategy guide predicts and recommends the following:
* In the first round, your opponent will choose Rock (`A`), and you should choose Paper (`Y`). This ends in a win for you with a score of *8* (2 because you chose Paper + 6 because you won).
* In the second round, your opponent will choose Paper (`B`), and you should choose Rock (`X`). This ends in a loss for you with a score of *1* (1 + 0).
* The third round is a draw with both players choosing Scissors, giving you a score of 3 + 3 = *6*.
In this example, if you were to follow the strategy guide, you would get a total score of `*15*` (8 + 1 + 6).
*What would your total score be if everything goes exactly according to your strategy guide?*
# Part Two
The Elf finishes helping with the tent and sneaks back over to you. "Anyway, the second column says how the round needs to end: `X` means you need to lose, `Y` means you need to end the round in a draw, and `Z` means you need to win. Good luck!"
The total score is still calculated in the same way, but now you need to figure out what shape to choose so the round ends as indicated. The example above now goes like this:
* In the first round, your opponent will choose Rock (`A`), and you need the round to end in a draw (`Y`), so you also choose Rock. This gives you a score of 1 + 3 = *4*.
* In the second round, your opponent will choose Paper (`B`), and you choose Rock so you lose (`X`) with a score of 1 + 0 = *1*.
* In the third round, you will defeat your opponent's Scissors with Rock for a score of 1 + 6 = *7*.
Now that you're correctly decrypting the ultra top secret strategy guide, you would get a total score of `*12*`.
Following the Elf's instructions for the second column, *what would your total score be if everything goes exactly according to your strategy guide?*

View File

@ -37,8 +37,49 @@ In the above example, the priority of the item type that appears in both compart
Find the item type that appears in both compartments of each rucksack. *What is the sum of the priorities of those item types?*
To begin, [get your puzzle input](3/input).
Your puzzle answer was `8109`.
Answer:
\--- Part Two ---
----------
You can also [Shareon [Twitter](https://twitter.com/intent/tweet?text=%22Rucksack+Reorganization%22+%2D+Day+3+%2D+Advent+of+Code+2022&url=https%3A%2F%2Fadventofcode%2Ecom%2F2022%2Fday%2F3&related=ericwastl&hashtags=AdventOfCode) [Mastodon](javascript:void(0);)] this puzzle.
As you finish identifying the misplaced items, the Elves come to you with another issue.
For safety, the Elves are divided into groups of three. Every Elf carries a badge that identifies their group. For efficiency, within each group of three Elves, the badge is the *only item type carried by all three Elves*. That is, if a group's badge is item type `B`, then all three Elves will have item type `B` somewhere in their rucksack, and at most two of the Elves will be carrying any other item type.
The problem is that someone forgot to put this year's updated authenticity sticker on the badges. All of the badges need to be pulled out of the rucksacks so the new authenticity stickers can be attached.
Additionally, nobody wrote down which item type corresponds to each group's badges. The only way to tell which item type is the right one is by finding the one item type that is *common between all three Elves* in each group.
Every set of three lines in your list corresponds to a single group, but each group can have a different badge item type. So, in the above example, the first group's rucksacks are the first three lines:
```
vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
```
And the second group's rucksacks are the next three lines:
```
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw
```
In the first group, the only item type that appears in all three rucksacks is lowercase `r`; this must be their badges. In the second group, their badge item type must be `Z`.
Priorities for these items must still be found to organize the sticker attachment efforts: here, they are 18 (`r`) for the first group and 52 (`Z`) for the second group. The sum of these is `*70*`.
Find the item type that corresponds to the badges of each three-Elf group. *What is the sum of the priorities of those item types?*
Your puzzle answer was `2738`.
Both parts of this puzzle are complete! They provide two gold stars: \*\*
At this point, you should [return to your Advent calendar](/2022) and try another puzzle.
If you still want to see it, you can [get your puzzle input](3/input).
You can also [Shareon [Twitter](https://twitter.com/intent/tweet?text=I%27ve+completed+%22Rucksack+Reorganization%22+%2D+Day+3+%2D+Advent+of+Code+2022&url=https%3A%2F%2Fadventofcode%2Ecom%2F2022%2Fday%2F3&related=ericwastl&hashtags=AdventOfCode) [Mastodon](javascript:void(0);)] this puzzle.