diff options
Diffstat (limited to 'src/2022/day12/aoc.cpp')
-rw-r--r-- | src/2022/day12/aoc.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/2022/day12/aoc.cpp b/src/2022/day12/aoc.cpp index 76a2384..c0d1db5 100644 --- a/src/2022/day12/aoc.cpp +++ b/src/2022/day12/aoc.cpp @@ -1,9 +1,23 @@ #include "aoc.h" +#include <algorithm> namespace aoc2022 { std::pair<int, int> day12(line_view file) { - return {0, 0}; + int row{0}; + heightmap hm; + per_line(file, [&hm, &row](line_view lv){ + hm.load(row++, lv); + return true; + }); + + hm.print(); + std::vector<int> paths; + hm.was(hm.start) += 1; + hm.find(0, hm.start, paths); + + std::sort(paths.begin(), paths.end()); + return {paths[0], 0}; } } |