Checkmate!

Please compute the minimum number of movements to checkmate the black
king of a given (simplified) chess position, with the following
properties:

- It is white’s turn.

- White has no king: only queens, rooks and bishops.

- Black only has a king.

Input

Input consists of several cases. Each case begins with the position of
the black king, followed by a number n between 2 and 4, followed by the
position of n white pieces. Every given position is legal (except for
the missing white king). It is always possible to checkmate the black
king in at most 4 movements.

Output

For every position, print the minimum number of movements to checkmate
the black king.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T13:30:20.968Z

© Jutge.org, 2006–2026.
https://jutge.org
