Editorial for CCC '18 S3 - RoboThieves


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.

Author: aeternalis1

For 5 of the 15 marks available, there are no security cameras nor conveyor belts in the input. There will only be empty cells, walls and the robot's initial position. This can be solved using either BFS or DFS on the grid and storing the number of steps to get to each empty cell.

Time Complexity: \mathcal O(NM)

For another 5 of the 15 marks, there are no conveyor belts. Security cameras must now be taken into consideration. An array of size N by M can be used to keep track of which positions are under surveillance. This can be achieved by iterating up, left, down and right from the security cameras and marking positions as invalid for traversal. Don't forget that walls block the cameras' vision. BFS or DFS as before, without using invalid positions.

Time Complexity: \mathcal O(NM)

For full marks, both security cameras and conveyor belts must be considered. Mark invalid positions like in the second subtask. Marking conveyor belts in line of view is up to personal preference (since they can be considered separately while traversing the grid), but take care to mark the empty cells past them. Since the conveyors take no steps to traverse, the endpoint of each conveyor can be precomputed.

Time Complexity: \mathcal O(NM)


Comments

There are no comments at the moment.