CODE FESTIVAL 2017 qual A
C: Palindromic Matrix
I used classification to solve it. The official solution uses brute force
Given H and W, we can tell how many positions has 4 mirrors, 2 mirrors, and 1 mirror
So for each letter, we try to fit it into 4 mirrors, 2 mirrors, and 1 mirror, in that order one by one
The answer is no if when we run out of possible 1 mirror positions. Otherwise, yes.
D: Four Coloring
-
Covert Mahattan distance to Chebyshev Distance
-
Divide the converted grid into d * d squares
-
assign each 4 sqaures 4 colors. It is correct because each pair with distance d is in neighboring converted squares