Mercurial > hg > aoc
comparison 2017/day16/problem @ 34:049fb8e56025
Add problem statements and inputs
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Tue, 09 Jan 2018 21:51:44 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
33:bc652fa0a645 | 34:049fb8e56025 |
---|---|
1 --- Day 16: Permutation Promenade --- | |
2 | |
3 You come upon a very unusual sight; a group of programs here appear to | |
4 be dancing. | |
5 | |
6 There are sixteen programs in total, named a through p. They start by | |
7 standing in a line: a stands in position 0, b stands in position 1, | |
8 and so on until p, which stands in position 15. | |
9 | |
10 The programs' dance consists of a sequence of dance moves: | |
11 | |
12 Spin, written sX, makes X programs move from the end to the front, | |
13 but maintain their order otherwise. (For example, s3 on abcde | |
14 produces cdeab). | |
15 | |
16 Exchange, written xA/B, makes the programs at positions A and B | |
17 swap places. | |
18 | |
19 Partner, written pA/B, makes the programs named A and B swap | |
20 places. | |
21 | |
22 | |
23 For example, with only five programs standing in a line (abcde), they | |
24 could do the following dance: | |
25 | |
26 s1, a spin of size 1: eabcd. | |
27 | |
28 x3/4, swapping the last two programs: eabdc. | |
29 | |
30 pe/b, swapping programs e and b: baedc. | |
31 | |
32 After finishing their dance, the programs end up in order baedc. | |
33 | |
34 You watch the dance for a while and record their dance moves (your | |
35 puzzle input). In what order are the programs standing after their | |
36 dance? | |
37 | |
38 Your puzzle answer was bkgcdefiholnpmja. | |
39 | |
40 --- Part Two --- | |
41 | |
42 Now that you're starting to get a feel for the dance moves, you turn | |
43 your attention to the dance as a whole. | |
44 | |
45 Keeping the positions they ended up in from their previous dance, the | |
46 programs perform it again and again: including the first dance, a | |
47 total of one billion (1000000000) times. | |
48 | |
49 In the example above, their second dance would begin with the order | |
50 baedc, and use the same dance moves: | |
51 | |
52 s1, a spin of size 1: cbaed. | |
53 | |
54 x3/4, swapping the last two programs: cbade. | |
55 | |
56 pe/b, swapping programs e and b: ceadb. | |
57 | |
58 In what order are the programs standing after their billion dances? | |
59 | |
60 Your puzzle answer was knmdfoijcbpghlea. | |
61 | |
62 Both parts of this puzzle are complete! They provide two gold stars: ** |