mirror of
https://github.com/mx42/aoc2024.rs.git
synced 2026-01-14 05:49:53 +01:00
chore: clippy + time
This commit is contained in:
@@ -35,8 +35,9 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
|
||||
| [Day 7](./src/bin/07.rs) | `43.5ms` | `3.7s` |
|
||||
| [Day 8](./src/bin/08.rs) | `110.0µs` | `395.4µs` |
|
||||
| [Day 9](./src/bin/09.rs) | `897.8µs` | `549.0ms` |
|
||||
| [Day 10](./src/bin/10.rs) | `836.4µs` | `1.6ms` |
|
||||
|
||||
**Total: 12224.23ms**
|
||||
**Total: 12226.66ms**
|
||||
<!--- benchmarking table --->
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
advent_of_code::solution!(10);
|
||||
|
||||
use std::iter::successors;
|
||||
|
||||
#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)]
|
||||
struct Pos {
|
||||
x: usize,
|
||||
@@ -94,27 +92,6 @@ impl Topo {
|
||||
}
|
||||
}
|
||||
|
||||
fn print_route(route: Vec<(Pos, u8)>, max: &Pos) {
|
||||
println!("==========");
|
||||
for y in 0..max.y {
|
||||
print!("|");
|
||||
for x in 0..max.x {
|
||||
let mut found = false;
|
||||
for r in &route {
|
||||
if r.0.x == x && r.0.y == y {
|
||||
found = true;
|
||||
print!("{}", r.1);
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
print!(" ");
|
||||
}
|
||||
}
|
||||
println!("|");
|
||||
}
|
||||
println!("==========");
|
||||
}
|
||||
|
||||
pub fn part_one(input: &str) -> Option<usize> {
|
||||
let topo = Topo::init(input).ok()?;
|
||||
let ths = topo.get_trailheads();
|
||||
|
||||
Reference in New Issue
Block a user