USACO Silver 2016 January - Build Gates
Author: Maggie Liu
Appears In
Warning!
The official solution stores the farm in a boolean array with the origin at , but this is not sufficient. Since each fence segment is doubled, the maximum distance in each direction could be units, causing an input such as s to go out of bounds. To not go out of bounds, an array of size should be used: unit for the origin position, units in each direction from the origin and more unit in each direction to ensure that the farm includes area beyond the fence.
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!