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

31762번 - LED Matrix 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB88766090.909%

문제

A LED matrix is a two-dimensional array of LEDs that is used to display information. This is achieved by turning on the LEDs that form a desired pattern. The figure below represents a LED matrix displaying a smiling-face pattern. LEDs that are turned off are shown in white, while LEDs that are turned on appear colored.

Some LED matrices scroll the pattern from right to left across the matrix, turning on just the appropriate LEDs at each step. Thus, any pattern with the same height than the matrix can be displayed, even patterns that are wider than the matrix. The pattern scrolling works as follows: Initially, all the LEDs in the matrix are turned off. The next step, the last column of the matrix displays the first column of the pattern. At each new step the pattern is moved one column to the left across the matrix, until the first column of the matrix displays the last column of the pattern. Finally, all the LEDs in the matrix are turned off again. If a LED matrix is equipped with pattern scrolling, the scrolling occurs even if the pattern if not wider than the matrix.

The picture below shows all the step required to display a pattern of an arrow that is pointing to the left.

Astrid has just received an old LED matrix with pattern scrolling, and she thinks that some LEDs might be broken. Since broken LEDs cannot be turned on, she is worried that some patterns will not display properly. Given the description of the state of each LED, and the pattern to display, you must tell whether the appropriate LEDs can be turned on at every step of the pattern scrolling.

입력

The first line contains three integers $R,ドル $C$ and $K$ (1ドル ≤ R, C, K ≤ 1000$), indicating respectively the number of rows of both the LED matrix and the pattern, the number of columns of the matrix, and the number of columns of the pattern.

The next $R$ lines describe the matrix and the pattern from top to bottom. Each of these lines contains a string $M$ of length $C$ and a string $P$ of length $K,ドル describing respectively a row of the matrix and a row of the pattern. Each character of both $M$ and $P$ is either “*” (asterisk) or “-” (hyphen). For $M,ドル the character “*” indicates a good LED while the character “-” represents a broken LED. For $P,ドル the character “*” indicates a LED the must be turned on while the character “-” represents a LED that must be turned off.

출력

Output a single line with the uppercase letter “Y” if the appropriate LEDs can be turned on at every step of the pattern scrolling, and the uppercase letter “N” otherwise.

제한

예제 입력 1

6 6 6
****** --*---
****** -**---
****** ******
****** ******
****** -**---
*****- --*---

예제 출력 1

N

예제 입력 2

2 4 6
**** ------
***- *-----

예제 출력 2

N

예제 입력 3

2 6 4
****** ****
*-**-* ----

예제 출력 3

Y

예제 입력 4

1 1 1
* *

예제 출력 4

Y

예제 입력 5

1 1 1
* -

예제 출력 5

Y

예제 입력 6

1 1 1
- *

예제 출력 6

N

예제 입력 7

1 1 1
- -

예제 출력 7

Y

힌트

출처

ICPC > Regionals > Latin America > Latin America Championship > The 2024 ICPC Latin America Championship L번

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

출처

대학교 대회

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

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