시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 68 | 58 | 54 | 87.097% |
You are given an $n$-by-$n$ grid where each square is colored either black or white. A grid is correct if all of the following conditions are satisfied:
Given a grid, determine whether it is correct.
The first line contains an integer $n$ ($2\le n\le 24$; $n$ is even). Each of the next $n$ lines contains a string of length $n$ consisting solely of the characters 'B
' and 'W
', representing the colors of the grid squares.
If the grid is correct, print the number $1$ on a single line. Otherwise, print the number $0$ on a single line.
4 WBBW WBWB BWWB BWBW
1
4 BWWB BWBB WBBW WBWW
0
6 BWBWWB WBWBWB WBBWBW BBWBWW BWWBBW WWBWBB
0
6 WWBBWB BBWWBW WBWBWB BWBWBW BWBBWW WBWWBB
1
ICPC > Regionals > North America > North Central North America Regional > NCNA 2019 J번