Editorial for ICPC NEERC 2012 L - Labyrinth of the Minotaur
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 key fact to the solution:
- If one traverses the path from the entrance to the lair using left-hand rule and using right-hand rule, then an obstacle blocks all paths from the entrance to the lair if and only if it blocks both left-hand and right-hand paths
- Precompute the number of blocked cells and the number of cells visited by each path in each rectangular region
- This way, one can find the corresponding number in each rectangular region in time
- For each , use binary search to find the smallest square that blocks both left and right path; check that the resulting square is not blocked by any obstacles
Comments