y2024d14 tipp from reddit, most robots form the tree aka not evenly spread aka use quadrants and check all frames where they are not even

This commit is contained in:
2024-12-14 23:08:31 +01:00
parent fa842890ce
commit f56780d1cf
4 changed files with 860 additions and 0 deletions

27
y2024/src/bin/d14.rs Normal file
View File

@@ -0,0 +1,27 @@
use std::{fs, time::Instant};
use utils::time::get_elapsed_string;
use y2024::days::d14;
fn main() {
let now = Instant::now();
println!("Part 1:");
part1();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
let now = Instant::now();
println!("Part 2:");
part2();
println!("Ran in {}", get_elapsed_string(now.elapsed()));
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/14_input.txt")).unwrap();
println!("{}", d14::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/14_input.txt")).unwrap();
d14::process_part2(&content);
}