### PROBLEM LINKS

### DIFFICULTY

MEDIUM

### EXPLANATION

If we construct a graph where each vertex corresponds to a square of the chessboard, and an edge connects two squares if they cannot both hold knights. Our task is then to find the size of the maximum independent set of this graph. Note that if we color the squares of the chessboard black and white, a knight on a black square can only attack white squares, and a knight on a white square can only attack black squares. Thus, the graph is bipartite. Now, by König’s theorem, The size of the maximum independent set is the total number of vertices minus the size of the maximum matching. The maximum matching can easily be found in O(VE) using an augmenting paths algorithm, where V is the number of vertices and E is the number of edges. However, in this case E is O(V), so the solution can be found in O(V^{2}).

### SETTER’S SOLUTION

Can be found here.

### TESTER’S SOLUTION

Can be found here.