From f3d747b0dff368533a539ca8ff9a1e1c120a41b8 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Thu, 14 Dec 2023 17:37:54 +0100 Subject: [PATCH] day14: rust --- 14/README.md | 4 ++-- 14/day14.rs | 1 + README.md | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/14/README.md b/14/README.md index dc1f993..57be760 100644 --- a/14/README.md +++ b/14/README.md @@ -3,9 +3,9 @@ Today's language: **Rust** -Lines of code: **84** +Lines of code: **85** -Execution time: **0,171 s** +Execution time: **0,172 s** This solution uses a single function for the tilting procedure. Different tilting directions are achieved by "remapping" `x` and `y` through captures. diff --git a/14/day14.rs b/14/day14.rs index a4f9c85..fc8b404 100644 --- a/14/day14.rs +++ b/14/day14.rs @@ -72,6 +72,7 @@ fn main() { rocks = original.clone(); // find a cycle let mut rocks_store: Vec = Vec::new(); + rocks_store.reserve(200); let mut cycle_start: usize = 0; let mut cycle_length: usize = 0; for i in 0..1_000_000_000 as usize { diff --git a/README.md b/README.md index b1ffe01..a032d15 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,6 @@ This is a repository for my solutions for the [advent of code 2023](https://adve | [10](10) | Rust | 136 | 0,003 s | lots of bitwise operations | | [11](11) | Rust | 66 | 0,005 s | | | [13](13) | Rust | 84 | 0,002 s | binary encoding ftw | -| [14](14) | Rust | 84 | 0,171 s | no bruteforce in < 90 lines | +| [14](14) | Rust | 85 | 0,172 s | no bruteforce in < 90 lines | Lines of code are without blank lines and comments