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

19262번 - Fresh Matrix 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
6 초 256 MB287685.714%

문제

A matrix of 0s and 1s is good if there are no two 1s in two matrix cells which share a side.

A matrix of 0s and 1s is connected if between all pairs of 0s there is a path which doesn't contain any 1s, and every two consecutive cells of the path share a side.

How many good connected matrices of 0s and 1s with $n$ rows and $m$ columns are there? As the answer can be rather big, print only its remainder modulo prime $p$.

입력

On the first line, you are given three integers $n,ドル $m,ドル and $p$: the number of rows and columns in the matrix and an integer you should use for taking the modulo (2ドル \le n \le 11$; 1ドル \le m \le 10^9$; 2ドル \le p \le 10^9$; $p$ is prime).

출력

Print one integer: the number of good connected matrices modulo $p$.

제한

예제 입력 1

2 2 998244353

예제 출력 1

5

예제 입력 2

4 1 998244353

예제 출력 2

4

예제 입력 3

4 5 998244353

예제 출력 3

2749

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 2: ITMO U 1 Contest F번

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

출처

대학교 대회

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

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