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

33284번 - Blind Gauss 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB276520.000%

문제

Construct a square matrix with $n$ rows and $n$ columns consisting of nonnegative integers from 0ドル$ to 10ドル^{18}$ such that its determinant is equal to 1ドル$ and there are exactly $a_i$ odd numbers in the $i$-th row for each $i$ from 1ドル$ to $n,ドル or report that there is no such matrix.

입력

The first line contains a single integer $n$ (2ドル \le n \le 50$).

Each of the next $n$ lines contains a single integer $a_i$ (1ドル \leq a_i \leq n$).

출력

If there is no matrix that meets the requirements, output -1.

Otherwise, output $n$ lines with $n$ numbers $m_{i,j}$ in each (0ドル \leq m_{i,j} \leq 10^{18}$): the elements of the constructed matrix. If there are multiple solutions, print any one of them.

제한

예제 입력 1

2
1
1

예제 출력 1

1 0
0 1

예제 입력 2

2
2
1

예제 출력 2

1 1
1 2

예제 입력 3

4
3
3
3
3

예제 출력 3

1 0 1 1
1 1 1 2
1 1 2 3
0 1 1 3

예제 입력 4

3
2
2
2

예제 출력 4

-1

예제 입력 5

3
3
1
3

예제 출력 5

-1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 4: Danil Zashikhin && Atilla Gün Contest, supported by Pinely D번

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

출처

대학교 대회

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

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