Editorial for Another Contest 2 Problem 1 - Poutine
Submitting an official solution before solving the problem yourself is a bannable offence.
Let's start by solving the simplest possible case - when a trip must be done in 1 day.
In order to solve queries of this form, we're basically asking for the shortest path in the graph between those two vertices. With Floyd-Warshall, we can precompute answers for all of these queries in
How does this help us when the number of days a trip can take is larger than 1? For a 2-day trip between
Precomputing all of these values takes
Comments