Compare commits
1 Commits
main
...
50f491c76f
| Author | SHA1 | Date | |
|---|---|---|---|
|
50f491c76f
|
@@ -86,12 +86,6 @@ fn part1_memo(fwd: &Edges) -> u64 {
|
|||||||
|
|
||||||
#[aoc(day11, part2, MemoDfs)]
|
#[aoc(day11, part2, MemoDfs)]
|
||||||
fn part2_memo(edges: &Edges) -> u64 {
|
fn part2_memo(edges: &Edges) -> u64 {
|
||||||
// we assume all valid paths reach svr->fft->dac->out in that order. this holds on the example and the input.
|
|
||||||
// to handle both possible orderings, we need to sum paths fft->dac and dac->fft, and then partition the graph
|
|
||||||
// (just remove the node) at dac & fft before computing the sum of dac->out and fft->out.
|
|
||||||
//
|
|
||||||
// this is our performance implementation though and it's faster to not do that work. we do the posterity for the
|
|
||||||
// naive solution
|
|
||||||
count_paths("svr", "fft", edges)
|
count_paths("svr", "fft", edges)
|
||||||
* count_paths("fft", "dac", edges)
|
* count_paths("fft", "dac", edges)
|
||||||
* count_paths("dac", "out", edges)
|
* count_paths("dac", "out", edges)
|
||||||
|
|||||||
Reference in New Issue
Block a user