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

23143번 - Sum 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB611100.000%

문제

Given a rectangular array $a$ of size $n \times m$ and a prime number $p,ドル find two rectangular arrays, $b$ of size $K \times n$ and $c$ of size $K \times m,ドル such that:

  1. 0ドル\le b_{i,j} < p$ ($\forall 1 \le i \le K, 1 \le j \le n$);
  2. 0ドル\le c_{i,j} < p$ ($\forall 1 \le i \le K, 1 \le j \le m$);
  3. $\sum_{j=1}^n b_{i,j} \ge 1$ ($\forall 1 \le i \le K$);
  4. $\sum_{i=1}^m c_{i,j} \ge 1$ ($\forall 1 \le j \le K$);
  5. $\sum_{l=1}^K b_{l,i} \cdot c_{l,j} \equiv a_{i,j} \pmod{p}$ ($\forall 1 \le i \le n, 1 \le j \le m$).

입력

The first line of input contains four positive integers $n,ドル $m,ドル $K,ドル $p$ (1ドル \le n \cdot m, K \cdot n, K \cdot m \le 10^5$; 2ドル \le p \le 10^9 + 7$; $p$ is prime).

The $i$-th of the following $n$ lines contains $m$ integers $a_{i,1}, a_{i,2}, \ldots, a_{i,m}$ (0ドル \le a_{i,j} < p$).

출력

If there is no solution, output a line "No solution!".

Otherwise, output $K$ lines, $i$-th of which contains $n + m$ integers $b_{i,1}, b_{i,2}, \ldots, b_{i,n}, c_{i,1}, c_{i,2}, \ldots, c_{i,m}$.

If there are several possible answers, print any one of them.

제한

예제 입력 1

1 1 1 97
0

예제 출력 1

No solution!

예제 입력 2

3 3 1 97
1 2 3
2 4 6
3 6 9

예제 출력 2

1 2 3 1 2 3

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 5: 2021 Shanghai ICPC Camp Onsite 2 by PKU F번

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

출처

대학교 대회

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

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