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

26867번 - Easily Distinguishable Triangles 다국어

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

문제

Eva loves painting. Today she is working with a square canvas of $n \times n$ unit cells. Each cell is painted white, painted black, or empty --- not painted at all.

Eva is going to draw a black triangle inside each empty cell. She wants each triangle to be right-angled and have an area of $\frac{1}{2}$ square unit cells. Thus, there are four ways to draw a single triangle:

Each triangle is a piece of art, and Eva wants them to be easily distinguishable from the rest of the painting. To achieve that, no two black triangles may share a common side with each other, and no black triangle may share a common side with a black square. Note that two black squares are allowed to share a common side.

Help Eva to find out how many ways there are to finish her painting. Since the number can be large, calculate it modulo 998ドル,244円,353円$.

입력

The first line contains a single integer $n$ --- the side length of the canvas (1ドル \le n \le 1000$).

The next $n$ lines describe the canvas from top to bottom. The $i$-th of these lines contains $n$ characters $s_{i, 1}, s_{i, 2}, \ldots, s_{i, n}$. If $s_{i, j} =$ '.', the cell in the $i$-th row and the $j$-th column of the canvas is painted white. If $s_{i, j} =$ '#', that cell is painted black. If $s_{i, j} =$ '?', that cell is empty.

출력

Print a single integer denoting the number of ways to finish Eva's painting, modulo 998ドル,244円,353円$.

제한

예제 입력 1

2
.?
?#

예제 출력 1

4

예제 입력 2

3
#??
#??
?##

예제 출력 2

1

예제 입력 3

3
.#.
#?#
.#.

예제 출력 3

0

노트

In the first example test, there are 4ドル$ ways to finish the painting, as illustrated below:

In the second example test, there is a single way to finish the painting:

In the third example test, regardless of how Eva draws the triangle in the center cell, it will share two sides with black squares.

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > ICPC 2022-2023 North-Western Russia Regional Contest E번

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

출처

대학교 대회

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

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