|
|
вернуться в форумThe problem description is very unclear: here is a clarification Each crossroads in the input is the binary OR of its branches, so a 5 (binary 101) at some crossroads in the input means there are branches 4 (100) and 1 (001) there. As for the output, for each crossroads where there are no branches (each 0, let's call this crossroads P), repeat this: Find the Manhattan (vertical+horizontal) distance to the closest branch from C. In the description, this closest distance is 2. Next, find all branches that lie on this exact distance from C. In the description, these are branches with number 16, 8, and 4. The output at location P should reflect all types of branches at distance 2 by ORing these numbers together, and in the description we get 28 (binary 10000 | 1000 | 100). |
|
|