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

22934번 - You be The Judge, Again 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB (추가 메모리 없음)135845157.303%

문제

You are a judge, again! The contest you're judging includes the following problem:

You have one L-shaped triomino of each of $\frac{4^n-1}{3}$ different colors. Tile a 2ドル^n$ by 2ドル^n$ grid using each of these triominos such that there is exactly one blank square and all other squares are covered by exactly one square of such a triomino. All triominos must be used."

Your team is to write a checker for this problem. Validation of the input values and format has already taken place. You will be given a purported tiling of a 2ドル^n$ by 2ドル^n$ grid, where each square in the grid is either 0 or a positive integer from 1ドル$ to $\frac{4^n-1}{3}$ representing one of the colors. Determine if it is, indeed, a covering of the grid with $\frac{4^n-1}{3}$ unique triominos and a single empty space.

L-shaped triominos look like this:

입력

The first line of input contains a single integer $n$ (1ドル \le n \le 10$), which is the $n$ of the description.

Each of the next 2ドル^n$ lines contains 2ドル^n$ integers $x$ (0ドル \le x \le \frac{4^n-1}{3}$), where 0 represents an empty space, and any positive number is a unique identifier of a triomino.

출력

Output a single integer, which is 1ドル$ if the given grid is covered with $\frac{4^n-1}{3}$ unique triominos and a single empty space. Otherwise, output 0ドル$.

제한

예제 입력 1

2
1 1 2 2
1 3 3 2
4 4 3 5
4 0 5 5

예제 출력 1

1

예제 입력 2

1
1 1
1 1

예제 출력 2

0

힌트

출처

ICPC > Regionals > North America > North America Championship > North America Championship 2021 M번

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 2: The American Contest M번

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

출처

대학교 대회

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

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