aboutsummaryrefslogtreecommitdiff
path: root/2022/24/b.rs
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-07-09 17:18:36 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-07-09 17:18:36 +0200
commitee0cbf2ec592b28dca6d1142639e06de52ff1b3e (patch)
treeb05c4e9e94588729e7a339b0736a38c559b2d691 /2022/24/b.rs
parent9637b5a1f8d10e3003651c5d9006f0e102f74f18 (diff)
downloadaoc-ee0cbf2ec592b28dca6d1142639e06de52ff1b3e.tar.gz
aoc-ee0cbf2ec592b28dca6d1142639e06de52ff1b3e.zip
Day 24 2022
Diffstat (limited to '2022/24/b.rs')
-rw-r--r--2022/24/b.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/2022/24/b.rs b/2022/24/b.rs
new file mode 100644
index 0000000..e6ca59f
--- /dev/null
+++ b/2022/24/b.rs
@@ -0,0 +1,14 @@
1mod common;
2use common::*;
3
4fn main() {
5 // The approach is greedy: once we reach the start / finish cell,
6 // we can wait there as long as we want, so it is always better
7 // to reach the partial destinations as soon as possible.
8
9 let map = read_map_from_stdin();
10 let a = map.shortest_path(Position::Start, Position::Finish, 0);
11 let b = map.shortest_path(Position::Finish, Position::Start, a);
12 let c = map.shortest_path(Position::Start, Position::Finish, b);
13 println!("{c}");
14}

Generated with cgit - Back to sebastiano.tronto.net