aoc

My solutions for the Advent of Code
git clone https://git.tronto.net/aoc
Download | Log | Files | Refs | README

b.rs (508B)


      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 }