1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
--- Day 11: Dumbo Octopus ---
You enter a large cavern full of rare bioluminescent dumbo octopuses! They seem to not like the
Christmas lights on your submarine, so you turn them off for now.
There are 100 octopuses arranged neatly in a 10 by 10 grid. Each octopus slowly gains
[1m[37menergy[0m over time and [1m[37mflashes[0m brightly for a moment when its energy is full. Although your lights are
off, maybe you could navigate through the cave without disturbing the octopuses if you could predict
when the flashes of light will happen.
Each octopus has an [1m[37menergy level[0m - your submarine can remotely measure the energy level of each
octopus (your puzzle input). For example:
5483143223
2745854711
5264556173
6141336146
6357385478
4167524645
2176841721
6882881134
4846848554
5283751526
The energy level of each octopus is a value between 0 and 9. Here, the top-left octopus has an
energy level of 5, the bottom-right one has an energy level of 6, and so on.
You can model the energy levels and flashes of light in [1m[37msteps[0m. During a single step, the following
occurs:
- First, the energy level of each octopus increases by 1.
- Then, any octopus with an energy level greater than 9 [1m[37mflashes[0m. This increases the energy level of
all adjacent octopuses by 1, including octopuses that are diagonally adjacent. If this causes an
octopus to have an energy level greater than 9, it [1m[37malso flashes[0m. This process continues as long as
new octopuses keep having their energy level increased beyond 9. (An octopus can only flash
[1m[37mat most once per step[0m.)
- Finally, any octopus that flashed during this step has its energy level set to 0, as it used all
of its energy to flash.
Adjacent flashes can cause an octopus to flash on a step even if it begins that step with very
little energy. Consider the middle octopus with 1 energy in this situation:
Before any steps:
11111
19991
19191
19991
11111
After step 1:
34543
4[1m[37m000[0m4
5[1m[37m000[0m5
4[1m[37m000[0m4
34543
After step 2:
45654
51115
61116
51115
45654
An octopus is [1m[37mhighlighted[0m when it flashed during the given step.
Here is how the larger example above progresses:
Before any steps:
5483143223
2745854711
5264556173
6141336146
6357385478
4167524645
2176841721
6882881134
4846848554
5283751526
After step 1:
6594254334
3856965822
6375667284
7252447257
7468496589
5278635756
3287952832
7993992245
5957959665
6394862637
After step 2:
88[1m[37m0[0m7476555
5[1m[37m0[0m89[1m[37m0[0m87[1m[37m0[0m54
85978896[1m[37m0[0m8
84857696[1m[37m00[0m
87[1m[37m00[0m9[1m[37m0[0m88[1m[37m00[0m
66[1m[37m000[0m88989
68[1m[37m0000[0m5943
[1m[37m000000[0m7456
9[1m[37m000000[0m876
87[1m[37m0000[0m6848
After step 3:
[1m[37m00[0m5[1m[37m0[0m9[1m[37m00[0m866
85[1m[37m00[0m8[1m[37m00[0m575
99[1m[37m000000[0m39
97[1m[37m000000[0m41
9935[1m[37m0[0m8[1m[37m00[0m63
77123[1m[37m00000[0m
791125[1m[37m000[0m9
221113[1m[37m0000[0m
[1m[37m0[0m421125[1m[37m000[0m
[1m[37m00[0m21119[1m[37m000[0m
After step 4:
2263[1m[37m0[0m31977
[1m[37m0[0m923[1m[37m0[0m31697
[1m[37m00[0m3222115[1m[37m0[0m
[1m[37m00[0m41111163
[1m[37m00[0m76191174
[1m[37m00[0m53411122
[1m[37m00[0m4236112[1m[37m0[0m
5532241122
1532247211
113223[1m[37m0[0m211
After step 5:
4484144[1m[37m000[0m
2[1m[37m0[0m44144[1m[37m000[0m
2253333493
1152333274
11873[1m[37m0[0m3285
1164633233
1153472231
6643352233
2643358322
2243341322
After step 6:
5595255111
3155255222
33644446[1m[37m0[0m5
2263444496
2298414396
2275744344
2264583342
7754463344
3754469433
3354452433
After step 7:
67[1m[37m0[0m7366222
4377366333
4475555827
34966557[1m[37m0[0m9
35[1m[37m00[0m6256[1m[37m0[0m9
35[1m[37m0[0m9955566
3486694453
8865585555
486558[1m[37m0[0m644
4465574644
After step 8:
7818477333
5488477444
5697666949
46[1m[37m0[0m876683[1m[37m0[0m
473494673[1m[37m0[0m
474[1m[37m00[0m97688
69[1m[37m0000[0m7564
[1m[37m000000[0m9666
8[1m[37m00000[0m4755
68[1m[37m0000[0m7755
After step 9:
9[1m[37m0[0m6[1m[37m0000[0m644
78[1m[37m00000[0m976
69[1m[37m000000[0m8[1m[37m0[0m
584[1m[37m00000[0m82
5858[1m[37m0000[0m93
69624[1m[37m00000[0m
8[1m[37m0[0m2125[1m[37m000[0m9
222113[1m[37m000[0m9
9111128[1m[37m0[0m97
7911119976
After step 10:
[1m[37m0[0m481112976
[1m[37m00[0m31112[1m[37m00[0m9
[1m[37m00[0m411125[1m[37m0[0m4
[1m[37m00[0m811114[1m[37m0[0m6
[1m[37m00[0m991113[1m[37m0[0m6
[1m[37m00[0m93511233
[1m[37m0[0m44236113[1m[37m0[0m
553225235[1m[37m0[0m
[1m[37m0[0m53225[1m[37m0[0m6[1m[37m00[0m
[1m[37m00[0m3224[1m[37m0000[0m
After step 10, there have been a total of 204 flashes. Fast forwarding, here is the same
configuration every 10 steps:
After step 20:
3936556452
56865568[1m[37m0[0m6
449655569[1m[37m0[0m
444865558[1m[37m0[0m
445686557[1m[37m0[0m
568[1m[37m00[0m86577
7[1m[37m00000[0m9896
[1m[37m0000000[0m344
6[1m[37m000000[0m364
46[1m[37m0000[0m9543
After step 30:
[1m[37m0[0m643334118
4253334611
3374333458
2225333337
2229333338
2276733333
2754574565
5544458511
9444447111
7944446119
After step 40:
6211111981
[1m[37m0[0m421111119
[1m[37m00[0m42111115
[1m[37m000[0m3111115
[1m[37m000[0m3111116
[1m[37m00[0m65611111
[1m[37m0[0m532351111
3322234597
2222222976
2222222762
After step 50:
9655556447
48655568[1m[37m0[0m5
448655569[1m[37m0[0m
445865558[1m[37m0[0m
457486557[1m[37m0[0m
57[1m[37m000[0m86566
6[1m[37m00000[0m9887
8[1m[37m000000[0m533
68[1m[37m00000[0m633
568[1m[37m0000[0m538
After step 60:
25333342[1m[37m00[0m
274333464[1m[37m0[0m
2264333458
2225333337
2225333338
2287833333
3854573455
1854458611
1175447111
1115446111
After step 70:
8211111164
[1m[37m0[0m421111166
[1m[37m00[0m42111114
[1m[37m000[0m4211115
[1m[37m0000[0m211116
[1m[37m00[0m65611111
[1m[37m0[0m532351111
7322235117
5722223475
4572222754
After step 80:
1755555697
59655556[1m[37m0[0m9
448655568[1m[37m0[0m
445865558[1m[37m0[0m
457[1m[37m0[0m86557[1m[37m0[0m
57[1m[37m000[0m86566
7[1m[37m00000[0m8666
[1m[37m0000000[0m99[1m[37m0[0m
[1m[37m0000000[0m8[1m[37m00[0m
[1m[37m0000000000[0m
After step 90:
7433333522
2643333522
2264333458
2226433337
2222433338
2287833333
2854573333
4854458333
3387779333
3333333333
After step 100:
[1m[37m0[0m397666866
[1m[37m0[0m749766918
[1m[37m00[0m53976933
[1m[37m000[0m4297822
[1m[37m000[0m4229892
[1m[37m00[0m53222877
[1m[37m0[0m532222966
9322228966
7922286866
6789998766
After 100 steps, there have been a total of [1m[37m1656[0m flashes.
Given the starting energy levels of the dumbo octopuses in your cavern, simulate 100 steps.
[1m[37mHow many total flashes are there after 100 steps?[0m
|