Journeys counted twice
transcript
Count journeys that pass a promotion page. Multiply in by out? It double counts.
Add in times out over the pages. The sum is four. But only three journeys exist.
One journey passes both pages. It is counted for each page. So the sum is too high.
Count all journeys first. Subtract those that avoid every promotion page. Now each journey counts once.
A hundred thousand pages give astronomical counts. So take every count modulo a prime. Subtract modulo too, and keep it positive.
Test two promotion pages in a row. Test a start page that is promoted. Compare with a brute force.
Write a brute force that lists every journey. Check whether each one passes a promotion page. Compare the counts on tiny graphs.
In topological order every link goes forward. So a page is final when you reach it. One pass counts all journeys.
Avoid double counting. Total minus avoiders. Full breakdown in the lecture.