aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2023-01-05 17:59:59 +0800
committerkaiwu <kaiwu2004@gmail.com>2023-01-05 18:00:34 +0800
commit8dad6446d6d3e59b01a90744df4c04bba1503d5d (patch)
tree09b8430e68e707727b4b2f4086ffc45f55f4ba2b /src
parent73dede45dfecaf1f34f2c7c57cb773fc117d8524 (diff)
downloadadvent-of-code-8dad6446d6d3e59b01a90744df4c04bba1503d5d.tar.gz
advent-of-code-8dad6446d6d3e59b01a90744df4c04bba1503d5d.zip
2022 day24 part1 dp
Diffstat (limited to 'src')
-rw-r--r--src/2022/day24/aoc.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/2022/day24/aoc.cpp b/src/2022/day24/aoc.cpp
index f87c252..52f90e0 100644
--- a/src/2022/day24/aoc.cpp
+++ b/src/2022/day24/aoc.cpp
@@ -24,10 +24,8 @@ void expedition(int m, pos p, pos target, valley& v, int* min, bool pass) {
}
else {
auto& t = v.get_time(p.y, p.x);
-
if (m < t || pass) {
- printf("(%d, %d) in %d, was %d\n", p.x, p.y, m, t);
- if (!pass) t = m;
+ // printf("(%d, %d) in %d, was %d\n", p.x, p.y, m, t);
v.next();
std::map<blizzard, int> mp;
@@ -45,10 +43,11 @@ void expedition(int m, pos p, pos target, valley& v, int* min, bool pass) {
{p.x-1, p.y},
p,
};
- for (int i = 0; i < (pass ? 2 : 5); i++) {
+ for (int i = 0; i < 5; i++) {
auto mv = mv0[i];
if (is_valid(mv, mp, v)) {
auto blz = v.blz;
+ t = m;
expedition(m + 1, mv, target, v, min, i > 1);
v.blz = blz;
}