Skip to content

Latest commit

 

History

History

Advent of Code 2019 solved in Rust

Link to AoC 2019


Advent of Code
        //2019

--- day01:
3395944
5091036
Elapsed: 898.667µs
--- day02:
5866663
4259
Elapsed: 1.511291ms
--- day03:
1337
65356
Elapsed: 69.858959ms
--- day04:
1955
1319
Elapsed: 146.563541ms
--- day05:
[3, 0, 0, 0, 0, 0, 0, 0, 0, 15508323]
[9006327]
Elapsed: 310µs
--- day06:
186597
412
Elapsed: 6.661833ms
--- day07:
24625
36497698
Elapsed: 23.440292ms
--- day08:
1441
XXX  X  X XXXX XXX  XXX  
X  X X  X    X X  X X  X 
X  X X  X   X  XXX  X  X 
XXX  X  X  X   X  X XXX  
X X  X  X X    X  X X    
X  X  XX  XXXX XXX  X    
Elapsed: 599.375µs
--- day09:
[68938]
Elapsed: 52.729666ms
--- day10:
Station at (26, 29) sees 303 asteroids
After rotation 1, 59 targets remain
After rotation 2, 18 targets remain
After rotation 3, 8 targets remain
After rotation 4, 3 targets remain
After rotation 5, 1 targets remain
After rotation 6, 0 targets remain
200th hit: 408
Elapsed: 12.663209ms
--- day11:
249
  ##   ##   ##  #    ###   ##    ## ####
 #  # #  # #  # #    #  # #  #    # #   
 #  # #    #  # #    #  # #       # ### 
 #### # ## #### #    ###  # ##    # #   
 #  # #  # #  # #    # #  #  # #  # #   
 #  #  ### #  # #### #  #  ###  ##  ####
Elapsed: 1.558041ms
--- day12:
6220
Full cycle repeated after 548525804273976 steps
Elapsed: 24.438ms
--- day13:
######################################
#                                    #
# X X  X   XX XXX X  X XX     X XX   #
# X  X   X   X X X X XXX X X  X XX   #
# XX X XX   XX X    XX XXX XX X XX   #
# XXXXXX XXXX  XX  XXXXX    XXXXXXX  #
# XX X XXXXXX  XXXXXX  X   XXXX X    #
# X   X X XXX  XX  XXX     XXX  X X  #
# XX  XXX     X  XXXX X  X  XX    XX #
#   X X X XX XXX XX XX   X   XXX     #
#   X  XX X X X  X X   XXXXXX XXXXXX #
#  X XXX  X X XXX  XX X XXXXXXX X X  #
# X X         XXXX     X XX X XXXXXX #
# XX   XXX  XX X XX XXX  XX XX  XXXX #
#  X  X      XX XXX       X  X  XX X #
# X  XXX XXXX  XX X XXXXXXX XXXXXX   #
#                                    #
#                o                   #
#                                    #
#                                    #
#                  _                 #
#                                    #
______________________________________
255
######################################
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                             o      #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                                    #
#                             _      #
#                                    #
______________________________________
Score: 12338
Elapsed: 111.780833ms
--- day14:
["ORE", "WSRVZ", "WXHJF", "XKDJ", "LKRTN", "MDPN", "QBDX", "VJWQR", "QTBC", "BGXJV", "NZKQZ", "LPWPD", "DRKQR", "BGTMN", "XJKN", "ZCMF", "PLSM", "FPTV", "LCKW", "HDKX", "HRWS", "TVSF", "ZHTX", "TDHPM", "NHPR", "DWZS", "LQWJ", "QPSF", "ZFVH", "TNMLB", "NVDCR", "RCBQS", "BGBJ", "SCJG", "SHBC", "FTFK", "THNDN", "RCKZ", "ZKHLC", "LBCZ", "RSKC", "CWHV", "LWHS", "FQSLN", "VKZFJ", "FWFXZ", "QVJMP", "GDTPC", "ZFXNP", "JQRF", "QGSN", "BCQN", "QJLF", "FMSZ", "TWLC", "PLVN", "DFCVF", "PQXG", "VJWTR", "DCRK", "NXZCH", "THKF", "JBLM", "FUEL"]
{"QBDX": 5509, "FWFXZ": 7, "QTBC": 1633, "RSKC": 148, "LBCZ": 179, "DCRK": 12, "DWZS": 202, "LWHS": 282, "BGXJV": 9796, "FTFK": 232, "XKDJ": 2779, "MDPN": 1313, "BGBJ": 304, "GDTPC": 288, "BGTMN": 2246, "ZFVH": 3, "DFCVF": 3, "BCQN": 84, "DRKQR": 456, "XJKN": 2408, "LKRTN": 2076, "JBLM": 42, "THNDN": 204, "HRWS": 1012, "NZKQZ": 1857, "QGSN": 1, "LPWPD": 630, "SCJG": 599, "FMSZ": 23, "TVSF": 227, "VJWQR": 20152, "VKZFJ": 11, "WSRVZ": 1370, "THKF": 18, "FUEL": 1, "RCBQS": 282, "QPSF": 6, "VJWTR": 11, "JQRF": 14, "TWLC": 3, "SHBC": 352, "ZKHLC": 90, "HDKX": 803, "ZCMF": 216, "FPTV": 556, "PQXG": 2, "NVDCR": 907, "NHPR": 112, "LQWJ": 18, "CWHV": 135, "RCKZ": 206, "ORE": 1590844, "TDHPM": 1, "NXZCH": 16, "ZFXNP": 509, "QJLF": 35, "FQSLN": 28, "LCKW": 1243, "PLSM": 1992, "PLVN": 72, "TNMLB": 1430, "WXHJF": 2779, "QVJMP": 1, "ZHTX": 16}
1590844
1184209
Elapsed: 9.231215334s
--- day15:
It takes 254 commands to reach the oxygen systems
 ######### ########### # ####### ##### # 
#.........#...........#.#.......#.....#.#
#.###.#####.#.#######.#.#.#####.#.#.#.#.#
#...#.......#.....#.#.#...#...#...#.#.#.#
 ##.#############.#.#.#####.#.#####.#.#.#
#.............#...#.........#.......#.#.#
#.#############.###.#################.#.#
#...#.....#...#.#.....#...#.............#
#.###.###.#.#.#.#####.#.#.#.############ 
#.#...#.#...#.#.#...#.#.#.#.#...........#
#.#.###.#####.#.#.#.###.#.#.#.#########.#
#.#.#.#.....#...#.#.....#.#.#...#.....#.#
 ##.#.#.#.#####.#.#######.#.###.#.###.#.#
#...#...#.......#.#.....#.#.#...#...#...#
#.#.#### ####.###.#.###.#.###.#####.#### 
#.#.#...#...#...#.#.#.#.#...#.....#.#...#
#.#.#.#.#.#.###.#.#.#.#.###.#####.#.#.#.#
#.#.#.#...#.#...#.#.#.#...#.#...#.#.#.#.#
#.###.#####.#####.#.#.###.#.#.#.#.#.#.## 
#.#...#...#...#...#.....#.#.#.#.#.#.#...#
#.#.###.#.###.#.#########.#.#.#.#.#.#.#.#
#.#...#.#...#.#.....#D..#.....#.#.#.#.#.#
#.###.###.#.#.#####.###.#######.#.#.###.#
#...#.....#.#.....#...#...#...#.#.#.#...#
#.#.###.#########.#.#.###.#.#.#.#.#.#.#.#
#.#.....#.....#...#.#...#.#.#.#.#.#.#.#.#
 ####.###.###.#.###.#####.#.###.#.#.#.#.#
#...#.#...#.#.#.#...#.....#...#...#.#.#.#
#.#.#.#.###.#.#.#.#.#.#######.#####.#.## 
#.#.#.#.#...#...#.#.#...#.........#.#...#
#.#.#.#.#.#.###.#.#####.#.#.###.###.###.#
#.#.#.#.#.#...#.#.......#.#.#...#...#...#
#.#.###.#.###.#.#########.#.#.###.###.#.#
#.#...#.#.#...#.......#...#.#...#.....#.#
#.###.#.#.###########.#.###.###########.#
#.#.....#.........#...#...#.............#
#.#########.#####.#.#####.############## 
#.........#.....#.......#.#...#...#.....#
#.#######.###############.#.#.#.#.#.###.#
#.......#...................#...#...#X..#
 ####### ################### ### ### ### 
It takes 268 minutes to fill the area with oxygen
Elapsed: 15.57125ms
--- day16:
19944447
"81207421"
Elapsed: 389.898875ms
--- day17:
......................###########........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#####....
......................#.............#....
......................#.............#....
......................#.............#....
......#####.....#######.............#....
......#...#.....#...................#....
......#...#.....#...........########O####
......#...#.....#...........#.......#...#
######O####.....#...........#.......#...#
#.....#.........#...........#.......#...#
#.....#.......##O##.........#.......#####
#.....#.......#.#.#.........#............
#.....#.......#.#.#.........#............
#.....#.......#.#.#.........#............
######O######.#.#.#.........#............
......#.....#.#.#.#.........#............
......######O#O##.###########............
............#.#..........................
..........##O#O#####^....................
..........#.#.#..........................
#####.....#.#.#############..............
#...#.....#.#.............#..............
#...#.....#.#.............#..............
#...#.....#.#.............#..............
####O#####O##.............#..............
....#.....#...............#..............
....#.....#...............###########....
....#.....#.........................#....
....#.....#.........................#....
....#.....#.........................#....
....#######.........................#....
....................................#....
....................................#....
....................................#....
....................................#....
....................................#....
..............................#######....
..............................#..........
..............................#..........
..............................#..........
..............................#..........
[(36, 12), (6, 14), (16, 16), (6, 20), (12, 22), (14, 22), (12, 24), (14, 24), (4, 30), (10, 30)]
Total intersection score is: 2508
Passing this sequence to intcode:
A,C,A,C,A,B,C,B,A,B
L,10,L,12,R,6
L,10,R,10,R,6,L,4
R,10,L,4,L,4,L,12
n

......................###########........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#####....
......................#.............#....
......................#.............#....
......................#.............#....
......#####.....#######.............#....
......#...#.....#...................#....
......#...#.....#...........#############
......#...#.....#...........#.......#...#
###########.....#...........#.......#...#
#.....#.........#...........#.......#...#
#.....#.......#####.........#.......#####
#.....#.......#.#.#.........#............
#.....#.......#.#.#.........#............
#.....#.......#.#.#.........#............
#############.#.#.#.........#............
......#.....#.#.#.#.........#............
......###########.###########............
............#.#..........................
..........##########^....................
..........#.#.#..........................
#####.....#.#.#############..............
#...#.....#.#.............#..............
#...#.....#.#.............#..............
#...#.....#.#.............#..............
#############.............#..............
....#.....#...............#..............
....#.....#...............###########....
....#.....#.........................#....
....#.....#.........................#....
....#.....#.........................#....
....#######.........................#....
....................................#....
....................................#....
....................................#....
....................................#....
....................................#....
..............................#######....
..............................#..........
..............................#..........
..............................#..........
..............................#..........
Main:
Function A:
Function B:
Function C:
Continuous video feed?
......................###########........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#........
......................#.........#####....
......................#.............#....
......................#.............#....
......................#.............#....
......#####.....#######.............#....
......#...#.....#...................#....
......#...#.....#...........#############
......#...#.....#...........#.......#...#
###########.....#...........#.......#...#
#.....#.........#...........#.......#...#
#.....#.......#####.........#.......#####
#.....#.......#.#.#.........#............
#.....#.......#.#.#.........#............
#.....#.......#.#.#.........#............
#############.#.#.#.........#............
......#.....#.#.#.#.........#............
......###########.###########............
............#.#..........................
..........###########....................
..........#.#.#..........................
#####.....#.#.#############..............
#...#.....#.#.............#..............
#...#.....#.#.............#..............
#...#.....#.#.............#..............
#############.............#..............
....#.....#...............#..............
....#.....#...............###########....
....#.....#.........................#....
....#.....#.........................#....
....#.....#.........................#....
....#######.........................#....
....................................#....
....................................#....
....................................#....
....................................#....
....................................#....
..............................#######....
..............................#..........
..............................#..........
..............................#..........
..............................v..........
The cleanup score is: 799463
Elapsed: 22.593ms
--- day18:
It takes at least 4510 steps to collect all keys
It takes at least 1816 steps to collect all keys by 4 robots
Elapsed: 4.571514s
--- day19:
There are 114 points affected by the beam in 50x50 area
#.................................................
..................................................
..................................................
..#...............................................
..................................................
...#..............................................
....#.............................................
..................................................
.....#............................................
......#...........................................
......#...........................................
.......#..........................................
........#.........................................
........#.........................................
.........#........................................
.........##.......................................
..........#.......................................
...........#......................................
...........##.....................................
............#.....................................
............##....................................
.............##...................................
.............##...................................
..............##..................................
...............##.................................
...............###................................
................##................................
................###...............................
.................###..............................
..................##..............................
..................###.............................
...................###............................
...................###............................
....................###...........................
.....................###..........................
.....................###..........................
......................###.........................
......................####........................
.......................###........................
.......................####.......................
........................####......................
.........................###......................
.........................####.....................
..........................####....................
..........................####....................
...........................####...................
............................####..................
............................#####.................
.............................####.................
.............................#####................

####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
Elapsed: 1.043649875s
--- day20:
It takes 620 steps to get from AA to ZZ
It takes 7366 steps to get from AA to ZZ with recurstion
Elapsed: 71.258875ms
--- day21:
Input instructions:

Walking...

ÿ
19361023
Input instructions:

Running...

z
1141457530
Elapsed: 102.830042ms
--- day22:
Position of card 2019 is 6850
Card 2020 ends up in position 13224103523662
Elapsed: 2.56775ms
--- day23:
The first y packet sent to 255 is 24268
The first y packet to be sent twice from NAT to 0 is 19316
Elapsed: 829.727041ms
--- day24:
First biodiversity to appear twice is: 26840049
After 200 minutes, there are 1995 bugs present
Elapsed: 49.555166ms
--- day25:



== Hull Breach ==
You got in through a hole in the floor here. To keep your ship from also freezing, the hole has been sealed.

Doors here lead:
- north
- south
- west

Command?



== Holodeck ==
Someone seems to have left it on the Giant Grid setting.

Doors here lead:
- north
- east
- south

Items here:
- tambourine

Command?

You take the tambourine.

Command?



== Sick Bay ==
Supports both Red-Nosed Reindeer medicine and regular reindeer medicine.

Doors here lead:
- east
- south
- west

Items here:
- astrolabe

Command?

You take the astrolabe.

Command?



== Corridor ==
The metal walls and the metal floor are slightly different colors. Or are they?

Doors here lead:
- north
- west

Command?



== Navigation ==
Status: Stranded. Please supply measurements from fifty stars to recalibrate.

Doors here lead:
- north
- south

Items here:
- klein bottle

Command?

You take the klein bottle.

Command?



== Hallway ==
This area has been optimized for something; you're just not quite sure what.

Doors here lead:
- south

Items here:
- easter egg

Command?

You take the easter egg.

Command?



== Navigation ==
Status: Stranded. Please supply measurements from fifty stars to recalibrate.

Doors here lead:
- north
- south

Command?



== Corridor ==
The metal walls and the metal floor are slightly different colors. Or are they?

Doors here lead:
- north
- west

Command?



== Sick Bay ==
Supports both Red-Nosed Reindeer medicine and regular reindeer medicine.

Doors here lead:
- east
- south
- west

Command?



== Gift Wrapping Center ==
How else do you wrap presents on the go?

Doors here lead:
- north

Items here:
- shell

Command?

You take the shell.

Command?



== Sick Bay ==
Supports both Red-Nosed Reindeer medicine and regular reindeer medicine.

Doors here lead:
- east
- south
- west

Command?



== Holodeck ==
Someone seems to have left it on the Giant Grid setting.

Doors here lead:
- north
- east
- south

Command?



== Hull Breach ==
You got in through a hole in the floor here. To keep your ship from also freezing, the hole has been sealed.

Doors here lead:
- north
- south
- west

Command?



== Passages ==
They're a little twisty and starting to look all alike.

Doors here lead:
- north
- south
- west

Command?



== Stables ==
Reindeer-sized. They're all empty.

Doors here lead:
- north

Items here:
- hypercube

Command?

You take the hypercube.

Command?

Items in your inventory:
- hypercube
- klein bottle
- shell
- easter egg
- astrolabe
- tambourine

Command?



== Passages ==
They're a little twisty and starting to look all alike.

Doors here lead:
- north
- south
- west

Command?



== Hull Breach ==
You got in through a hole in the floor here. To keep your ship from also freezing, the hole has been sealed.

Doors here lead:
- north
- south
- west

Command?



== Science Lab ==
You see evidence here of prototype polymer design work.

Doors here lead:
- east
- west

Items here:
- dark matter

Command?

You take the dark matter.

Command?



== Hot Chocolate Fountain ==
Somehow, it's still working.

Doors here lead:
- north
- east

Items here:
- giant electromagnet

Command?



== Kitchen ==
Everything's freeze-dried.

Doors here lead:
- east
- south
- west

Items here:
- molten lava

Command?



== Warp Drive Maintenance ==
It appears to be working normally.

Doors here lead:
- east
- west

Items here:
- escape pod

Command?



== Arcade ==
None of the cabinets seem to have power.

Doors here lead:
- west

Items here:
- infinite loop

Command?



== Warp Drive Maintenance ==
It appears to be working normally.

Doors here lead:
- east
- west

Items here:
- escape pod

Command?



== Kitchen ==
Everything's freeze-dried.

Doors here lead:
- east
- south
- west

Items here:
- molten lava

Command?



== Storage ==
The boxes just contain more boxes.  Recursively.

Doors here lead:
- east
- south

Items here:
- coin

Command?

You take the coin.

Command?



== Security Checkpoint ==
In the next room, a pressure-sensitive floor will verify your identity.

Doors here lead:
- north
- south

Command?

Items in your inventory:
- hypercube
- coin
- klein bottle
- shell
- easter egg
- astrolabe
- tambourine
- dark matter

Command?

You drop the klein bottle.

Command?

You drop the shell.

Command?

You drop the easter egg.

Command?

You drop the astrolabe.

Command?



== Pressure-Sensitive Floor ==
Analyzing...

Doors here lead:
- north

A loud, robotic voice says "Analysis complete! You may proceed." and you enter the cockpit.
Santa notices your small droid, looks puzzled for a moment, realizes what has happened, and radios your ship directly.
"Oh, hello! You should be able to get in by typing 2214608912 on the keypad at the main airlock."

Elapsed: 565.883959ms