Files
adventofcode/2025/day09/problem
2025-12-09 09:59:06 -06:00

146 lines
3.9 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[1]Advent of Code
• [2][About]
• [3][Events]
• [4][Shop]
• [5][Settings]
• [6][Log Out]
br0xen [7](AoC++) 16*
   0x0000|[8]2025
• [9][Calendar]
• [10][AoC++]
• [11][Sponsors]
• [12][Leaderboards]
• [13][Stats]
Our [14]sponsors help make Advent of Code possible:
[15]TNG Technology Consulting - We solve hard IT problems all year
round!
--- Day 9: Movie Theater ---
You slide down the [16]firepole in the corner of the playground and land
in the North Pole base movie theater!
The movie theater has a big tile floor with an interesting pattern. Elves
here are redecorating the theater by switching out some of the square
tiles in the big grid they form. Some of the tiles are red; the Elves
would like to find the largest rectangle that uses red tiles for two of
its opposite corners. They even have a list of where the red tiles are
located in the grid (your puzzle input).
For example:
7,1
11,1
11,7
9,7
9,5
2,5
2,3
7,3
Showing red tiles as # and other tiles as ., the above arrangement of red
tiles would look like this:
..............
.......#...#..
..............
..#....#......
..............
..#......#....
..............
.........#.#..
..............
You can choose any two red tiles as the opposite corners of your
rectangle; your goal is to find the largest rectangle possible.
For example, you could make a rectangle (shown as O) with an area of 24
between 2,5 and 9,7:
..............
.......#...#..
..............
..#....#......
..............
..OOOOOOOO....
..OOOOOOOO....
..OOOOOOOO.#..
..............
Or, you could make a rectangle with area 35 between 7,1 and 11,7:
..............
.......OOOOO..
.......OOOOO..
..#....OOOOO..
.......OOOOO..
..#....OOOOO..
.......OOOOO..
.......OOOOO..
..............
You could even make a thin rectangle with an area of only 6 between 7,3
and 2,3:
..............
.......#...#..
..............
..OOOOOO......
..............
..#......#....
..............
.........#.#..
..............
Ultimately, the largest rectangle you can make in this example has area
50. One way to do this is between 2,5 and 11,1:
..............
..OOOOOOOOOO..
..OOOOOOOOOO..
..OOOOOOOOOO..
..OOOOOOOOOO..
..OOOOOOOOOO..
..............
.........#.#..
..............
Using two red tiles as opposite corners, what is the largest area of any
rectangle you can make?
To begin, [17]get your puzzle input.
Answer: [18]_____________________ [19][ [Submit] ]
You can also [Shareon [20]Bluesky [21]Twitter [22]Mastodon] this puzzle.
References
Visible links
1. https://adventofcode.com/
2. https://adventofcode.com/2025/about
3. https://adventofcode.com/2025/events
4. https://adventofcode.com/2025/shop
5. https://adventofcode.com/2025/settings
6. https://adventofcode.com/2025/auth/logout
7. Advent of Code Supporter
https://adventofcode.com/2025/support
8. https://adventofcode.com/2025
9. https://adventofcode.com/2025
10. https://adventofcode.com/2025/support
11. https://adventofcode.com/2025/sponsors
12. https://adventofcode.com/2025/leaderboard/private
13. https://adventofcode.com/2025/stats
14. https://adventofcode.com/2025/sponsors
15. https://adventofcode.com/2025/sponsors/redirect?url=https%3A%2F%2Fwww%2Etngtech%2Ecom%2Fen%2F
16. https://en.wikipedia.org/wiki/Fireman%27s_pole
17. https://adventofcode.com/2025/day/9/input
20. https://bsky.app/intent/compose?text=%22Movie+Theater%22+%2D+Day+9+%2D+Advent+of+Code+2025+%23AdventOfCode+https%3A%2F%2Fadventofcode%2Ecom%2F2025%2Fday%2F9
21. https://twitter.com/intent/tweet?text=%22Movie+Theater%22+%2D+Day+9+%2D+Advent+of+Code+2025&url=https%3A%2F%2Fadventofcode%2Ecom%2F2025%2Fday%2F9&related=ericwastl&hashtags=AdventOfCode
22. javascript:void(0);