My solution for the advent of code 2021, mainly written in Rust

Overview

Advent-of-Code-2021

My solution for the advent of code 2021, written in Rust

Error Handle

NOPE!!! unwrap() everything everywhere

Use

To run all of the advent of code solutions

cargo run --release

To run only a specific day (replace {DAY_NUMBER} with the number of that day)

cargo run --release -- {DAY_NUMBER}

Performance

These timing was done on my shitty $5 VPS

Day - Name Parse time Part 1 Part 2 AoC link
01 - Sonar Sweep 93us 4us 19us ๐Ÿ”—
02 - Dive! 79us 8us 8us ๐Ÿ”—
03 - Binary Diagnostic 131us 86us 61us ๐Ÿ”—
04 - Giant Squid 90us 94us 62us ๐Ÿ”—
05 - Hydrothermal Venture 126us 1ms 560us 2ms 72us ๐Ÿ”—
06 - Lanternfish 7us 814ns 1us 61ns ๐Ÿ”—
07 - The Treachery of Whales 51us 450us 5ms 594us ๐Ÿ”—
08 - Seven Segment Search 93us 20us 432us ๐Ÿ”—
09 - Smoke Basin 89us 423us 3ms 927us ๐Ÿ”—
10 - Syntax Scoring 41us 96us 96us ๐Ÿ”—
11 - Dumbo Octopus 1us 908ns 1ms 474us 6ms 766us ๐Ÿ”—
12 - Passage Pathing 11us 2ms 822us 125ms ๐Ÿ”—
13 - Transparent Origami 209us 152us 1ms 120us ๐Ÿ”—
14 - Extended Polymerization 8us 35us 164us ๐Ÿ”—
15 - Chiton 16us 5ms 977us 183ms ๐Ÿ”—
16 - Packet Decoder - - - ๐Ÿ”—
17 - Trick Shot 999ns 100ns 443us 027ns ๐Ÿ”—
18 - Snailfish 93us 2ms 471us 44ms 780us ๐Ÿ”—
19 - Beacon Scanner 21s 394ms 82ns 5us 190ns ๐Ÿ”—
20 - Trench Map 677us 10ms 355us 629ms ๐Ÿ”—
21 - Dirac Dice 302ns 1us 194ns 24ms 412us ๐Ÿ”—

Note

  • Day 15 part 2: yep, 1 hour and 20 minutes Well, its execution time is now under 200 milliseconds...
  • Day 17 part 2: Brute forced it, computer's problems require programming solutions
  • Day 19: I calculate the beacons and scanners location while parsing the input since it does not require the full input to be done, that's why the execution time are fast but the parsing is not

Dependencies

  • humantime - to display the running time
  • owo-colors - to print colored result in terminal
You might also like...
Solutions to Advent of Code 2021, coded in rust

Advent of Code 2021 (aoc-2021-rust) Solutions to Advent of Code 2021 (https://adventofcode.com/2021), coded as part of my efforts to learn Rust Run co

Repository with my Advent of Code 2021 puzzle solutions ๐ŸŽ„
Repository with my Advent of Code 2021 puzzle solutions ๐ŸŽ„

๐ŸŽ„ Advent of Code 2021 ๐ŸŽ„ I decided to stick with Rust this year and try to improve a bit on it, I basically haven't used it since last year's AoC, so

Quick'n dirty macro set for advent of code 2021

AOC quick'n dirty macro set Those are implemented using quick'n dirty procedural macros and libraries. Running the program Use cargo run --release --

๐Ÿฆ€ Advent of Code 2021

Advent of Code 2021 License Licensed under either of Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) MIT li

Advent of Code - 2021

Advent of Code - 2021 Solutions to the Advent of Code 2021 written in Rust using cargo-aoc. Instructions Install cargo-aoc with cargo install cargo-ao

Soluciones a los retos del Advent of Code 2021.

Advent of Code 2021 Soluciones a Advent of Code 2021. Repos de otros miembros de AoC Canarias: Ricardo Cรกrdenes Vรญctor Ruiz Josรฉ Rodrรญguez Juan Ignaci

โ˜ƒ๏ธ Learning Rust with AoC 2021 ๐ŸŽ„https://adventofcode.com/2021/

๐ŸŽ„ Andrei's 2021 Advent of Code ๐ŸŽ„ Learning Goals Rust basics (vectors, arrays, math, etc.) Rust basic CLI Rust linear algebra and ndarrays (e.g., htt

Rust-advent - Learning Rust by solving advent of code challenges (Streaming live on Twitch every Monday)
Rust-advent - Learning Rust by solving advent of code challenges (Streaming live on Twitch every Monday)

Rust advent ๐Ÿฆ€ ๐Ÿš Learning Rust by implementing solutions for Advent of Code problems. ๐ŸŽฅ HEY, we are live-streaming our attempts to solve the exercis

Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers
Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers

Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers. It deals only with integer arithmetic. Expressions may involve mixed bases (limited to decimal, hexadecimal, octal and binary numbers). The global output format may be set to a particular radix - by default it is hex.

Owner
Nguyen Le Duy
Rust developer
Nguyen Le Duy
Advent of Code 2021 puzzles & solutions in Rust

Advent of Code 2021 These are puzzles for the Advent of Code 2021 challenge, written and solved in the Rust programming language. The puzzle for each

Chevy Ray Johnston 8 Dec 19, 2021
Advent of Code 2021 (Rust)

aoc-2021 Advent of Code 2021 with Rust. To build and run the project This project uses cargo-aoc. More detailed instructions can be found at that proj

Belรฉn Albeza 13 Dec 23, 2021
Advent of Code 2021, also an attempt to practice a bit of Rust.

Advent of Code 2021 Advent of Code 2021 (my first one!), also an attempt to practice a bit of Rust. Running (Assuming that the respective inputs are i

Edoardo Debenedetti 1 Dec 3, 2021
My solutions to Advent of Code 2021 (mostly in rust)

Advent of Code 2021 Small code to solve problems at https://adventofcode.com/2021. Most of the code are written in Rust. How to run solutions For exam

โ€œPlaneโ€ Abhabongse  Janthong 3 Apr 22, 2022
Learning Rust through Advent of Code 2021 - probably not very clean!

AoC 2021 ======== I'm using AoC2021 as an excuse to learn Rust (and maybe some other languages). Please do *not* use this repository as a good source

Andrew Zhu 0 Dec 8, 2021
๐ŸŽ„My Advent of Code 2021 solutions in the Rust programming language

Advent of Code 2021 in Rust My Advent of Code 2021 solutions in the Rust programming language. This repository holds a separate Rust project for each

Tim Visรฉe 227 Dec 16, 2022
My solutions for the Advent of Code 2021 in Scala, Python, Haskell and Rust.

Advent of Code 2021 These are my Advent of Code 2021 solutions written in Scala 3, Haskell, Python and Rust. Day Title L1 L2 L3 L4 01 Sonar Sweep Scal

Axel Suรกrez 2 Oct 14, 2022
Advent of Code 2021, in rust this year

Advent of Code 2021 ?? Solutions for the 2021 edition of Advent of Code. This year, I try to do this in Rust ?? . I discover the language, so do not t

Florian Gaudin-Delrieu 1 Aug 12, 2022
My solutions for Advent of Code 2021, in Rust

Advent of Code 2021 These are my solutions. I have decided to use Rust for now. I'm new to Rust, so it might be some of the worst Rust code you've see

Samyak Sarnayak 1 Jan 1, 2022
My solutions for the 2021 edition of the Advent of Code, using Rust and SOM (Simple Object Machine)

Advent of Code 2021 These are my solutions for the 2021 edition of the Advent of Code. The solutions are all implemented using both Rust and SOM (Simp

Nicolas Polomack 1 Dec 23, 2021