We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is a graph problem. Prisoners are vertices and chains are edges. All we need is to calculate the size of each component(group of prisoners) of the graph, then calculate cost of a bus for that capacity, and sum all costs.
Prison Transport
You are viewing a single comment's thread. Return to all comments →
This is a graph problem. Prisoners are vertices and chains are edges. All we need is to calculate the size of each component(group of prisoners) of the graph, then calculate cost of a bus for that capacity, and sum all costs.
Solution in Haskell using Data.Graph: