QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#623160 | #5736. Black and White | purelyKai | RE | 0ms | 0kb | Python3 | 1.1kb | 2024-10-09 10:26:42 | 2024-10-09 10:26:44 |
answer
import sys
sys.stdin = open('blackOrWhiteInput.txt', 'r')
def blackOrWhite(n, board):
t = 0
b = 0
w = 0
for i in range(n):
for j in range(n):
if board[i][j] == 'B':
t = t + 1
w = 0
b = b + 1
else:
t = t - 1
b = 0
w = w + 1
if b == 3 or b == -3 or w == 3 or w == -3:
print(0)
return
if t != 0:
print(0)
return
for i in range(n):
for j in range(n):
if board[j][i] == 'B':
t = t + 1
w = 0
b = b + 1
else:
t = t - 1
b = 0
w = w + 1
if b == 3 or b == -3 or w == 3 or w == -3:
print(0)
return
if t != 0:
print(0)
return
print(1)
return
n = int(input())
board = []
for i in range(n):
s = input()
board.append(list(s))
blackOrWhite(n, board)
詳細信息
Test #1:
score: 0
Dangerous Syscalls
input:
4 WBBW WBWB BWWB BWBW