Editorial for COCI '08 Regional #5 Reljef
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.
The task asks us to simulate the stick fight.
In every step, find the chunk of mineral that the thrown stick hits, delete it and check for any clusters floating in the air. If there is a floating cluster, we need to lower all the chunks it contains until one of the chunks lands on the ground or another cluster. Clusters can be found using breadth-first search (BFS) or depth-first search (DFS).
Comments