diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-09 17:18:36 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-09 17:18:36 +0200 |
| commit | ee0cbf2ec592b28dca6d1142639e06de52ff1b3e (patch) | |
| tree | b05c4e9e94588729e7a339b0736a38c559b2d691 /2022/24/b.rs | |
| parent | 9637b5a1f8d10e3003651c5d9006f0e102f74f18 (diff) | |
| download | aoc-ee0cbf2ec592b28dca6d1142639e06de52ff1b3e.tar.gz aoc-ee0cbf2ec592b28dca6d1142639e06de52ff1b3e.zip | |
Day 24 2022
Diffstat (limited to '2022/24/b.rs')
| -rw-r--r-- | 2022/24/b.rs | 14 |
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 @@ | |||
| 1 | mod common; | ||
| 2 | use common::*; | ||
| 3 | |||
| 4 | fn 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 | } | ||
