Editorial for COCI '20 Contest 6 #2 Alias
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
We can think of Rafael's database as a directed weighted graph. Since vertices are words, we need to first assign a unique integer between
Notice that the task asks for the length of the shortest path from vertex
For all points, we can use Dijkstra's algorithm for each question, which has
Comments