A board solitaire game

You have an n × m board. Some positions have objects that, when pressed,
start moving in the direction painted on them, until they leave the
board. The painted directions are ‘>’ for rightwards, ‘<’ for leftwards,
‘’ for upwards and ‘v’ for downwards. Note, you are only allowed to
press an object if its path is currently free from other objects. The
goal of the game is to empty the board. Can you win?

Input

Input consists of several cases, each with n and m, followed by n lines
with m characters each. Periods indicate empty cells. Assume that both n
and m are between 1 and 100, and that there is at least one object on
the board.

Output

Print a line for each case. If there is no solution, print “NO”.
Otherwise, print “YES” followed by all the positions of the objects (row
and column, the upper left position is (1, 1)), in the order that they
should be pressed. If there is more than one solution, you can print any
one. Follow strictly the format of the sample output.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:47:14.807Z

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