Logo
(追記) (追記ここまで)

27419번 - Move One Coin 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB153555035.461%

문제

Some coins are placed on grid points on a two-dimensional plane. No two coins are stacked on the same point. Let’s call this placement of coins the source pattern. Another placement of the same number of coins, called the target pattern, is also given.

The source pattern does not match the target pattern, but by moving exactly one coin in the source pattern to an empty grid point, the resulting new pattern matches the target pattern. Your task is to find out such a coin move.

Here, two patterns are said to match if one pattern is obtained from the other by applying some number of 90-degree rotations on the plane and a parallel displacement if necessary, but without mirroring. For example, in the source pattern on the left of Figure D.1, by moving the coin at $(1, 0)$ to $(3, 1),ドル we obtain the pattern on the right that matches the target pattern shown in Figure D.2.

Figure D.1. Source pattern and a move

Figure D.2. Target Pattern

입력

The input consists of a single test case of the following format.

$h$ $w$

$p_{0,0}$ $\cdots$ $p_{0,w-1}$

$\vdots$

$p_{h-1,0}$ $\cdots$ $p_{h-1,w-1}$

$H$ $W$

$P_{0,0}$ $\cdots$ $P_{0,W-1}$

$\vdots$

$P_{H-1,0}$ $\cdots$ $P_{H-1,W-1}$

The first line consists of two integers $h$ and $w,ドル both between 1ドル$ and 500ドル,ドル inclusive. $h$ is the height and $w$ is the width of the source pattern description. The next $h$ lines each consisting of $w$ characters describe the source pattern. The character $p_{y,x}$ being ‘o’ means that a coin is placed at $(x, y),ドル while ‘x’ means no coin is there.

The following lines with integers $H$ and $W,ドル and characters $P_{y,x}$ describe the target pattern in the same way.

출력

If the answer is to move the coin at $(x_0, y_0)$ to $(x_1, y_1),ドル print $x_0$ and $y_0$ in this order separated by a space character in the first line, and print $x_1$ and $y_1$ in this order separated by a space character in the second line.

It is ensured there is at least one move that satisfies the requirement. When multiple solutions exist, print any one of them.

Note that 0ドル ≤ x_0 < w$ and 0ドル ≤ y_0 < h$ always hold but $x_1$ and/or $y_1$ can be out of these ranges.

제한

예제 입력 1

2 3
xox
ooo
4 2
ox
ox
ox
ox

예제 출력 1

1 0
3 1

예제 입력 2

3 3
xox
oxo
xox
4 4
oxxx
xxox
xoxo
xxxx

예제 출력 2

1 2
-1 -1

힌트

출처

ICPC > Regionals > Asia Pacific > Japan > ICPC 2022 Asia Yokohama Regional D번

Camp > Petrozavodsk Programming Camp > Summer 2023 > Day 1: Starting Contest F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /