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

23589번 - Beautiful Tables 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 512 MB82225.000%

문제

Alice has a rectangular table consisting of $n \times m$ squares. Some squares are empty, and other are filled with integers.

Alice thinks that a table is beautiful if:

  • for every square which has neighbors both left and right, the number in it is half of the sum of numbers in these neighbors,
  • for every square which has neighbors both up and down, the number in it is half of the sum of numbers in these neighbors.

Alice want to check if she can put numbers (not necessary integers) in all empty squares to make her table beautiful. Also, if she can, she is interested if there is an unique way to do it.

입력

The first line contains two integers $n$ and $m$ (1ドル \le n, m \le 10$). The next $n$ lines describe of the table. Each of these lines contains $m$ tokens separated by spaces. Each token is either "?" if the respective square is empty, or the respective number if it is filled.

All the given numbers are integers not greater than 100ドル$ by absolute value. However, there are no such constraints on the numbers which Alice can put in empty cells.

출력

If there is no way to make the table beautiful, print the only word "None".

If there is an unique way to make the table beautiful, print the word "Unique" on the first line, and then $n$ lines containing the table after filling all empty squares.

제한

예제 입력 1

3 5
1 2 3 ? ?
? 5 ? ? ?
? ? ? 0 ?

예제 출력 1

Unique
1/1 2/1 3/1 4/1 5/1
13/2 5/1 7/2 2/1 1/2
12/1 8/1 4/1 0/1 -4/1

예제 입력 2

3 3
1 2 3
7 ? 4
? 6 5

예제 출력 2

None

예제 입력 3

2 2
1 2
? 4

예제 출력 3

Multiple
1/1 2/1
3/1 4/1
and
1/1 2/1
2/1 4/1

힌트

출처

Contest > Open Cup > 2018/2019 Season > Stage 3: Grand Prix of SPb K번

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

출처

대학교 대회

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

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