| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 | 256 MB | 29 | 4 | 4 | 80.000% |
Takahashikun likes to paint floors. There is a floor divided into $N \times N$ grid, and some (possibly zero) cells may contain obstacles.
The information about the grid is given as $N$ strings $S_1, \ldots, S_N$. The $j$-th character of $S_i$ represents the cell $(i, j)$: '.' and 's' represent an empty cell, and '#' represents a cell with obstacles.
There is excatly one cell with 's'. First, Takahashikun enters the cell with 's' and paints this cell. After that, he makes zero or more steps according to the following rule:
Determine if he can paint all cells without obstacles.
$N$
$S_1$
$S_2$
$\vdots$
$S_N$
Print "POSSIBLE" if he can paint all cells without obstacles. Otherwise print "IMPOSSIBLE".
.', '#', or 's'.s'..'.5 #.... ..s.. ..#.. #.... ##..#
POSSIBLE
5 s.### ..### ###.. #.... #..##
IMPOSSIBLE