Solitaire of the stones (2)

This exercise is a variation of the exercise SOPE1. The only difference in the rules of the game is that now the jumps do not make disappear the stones that have been jumped.

Write a program such that, given two configurations of a solitaire, prints if is possible to go from one to the other one.

Input

Input consists of a natural n3n \ge 3, followed by the descriptions of the two configurations, each one with nn rows with nn characters each one. A ’X’ indicates a stone. The empty positions are indicated with a dot.

Output

Your program must print "1" if you can go from one configuration to the other one, or "0" if it is not possible.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:10:41.251Z

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