QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#405114 | #3002. Busy Board | Lspeed | WA | 467ms | 23500kb | Python3 | 1.7kb | 2024-05-05 11:29:46 | 2024-05-05 11:29:46 |
Judging History
answer
n, m = map(int, input().split())
b = []
for i in range(n):
b.append(input())
g = [['.' for _ in range(m)] for k in range(n)]
ct1 = 0
ct2 = 0
for i in range(n):
for j in range(m):
g[i][j] = b[i][j]
if g[i][j] == 'X':
ct1 += 1
b = []
for i in range(n):
b.append(input())
t = [['.' for _ in range(m)] for k in range(n)]
for i in range(n):
for j in range(m):
t[i][j] = b[i][j]
if t[i][j] == 'X':
ct2 += 1
if ct1 == n*m:
if ct2 == n*m:
print(1)
else:
print(0)
else:
c = [1 for i in range(m)]
r = [1 for i in range(n)]
# print(len(r),len(c))
for i in range(n):
ct = 0
for j in range(m):
if t[i][j] == 'X':
ct += 1
if ct > 1:
r[i] = 0
for j in range(m):
if t[i][j] == 'X':
c[j] = 1
for j in range(m):
ct = 0
for i in range(n):
if t[i][j] == 'X':
# print(i,j)
ct += 1
if ct > 1:
# print(j,m,n,ct)
c[j] = 0
for i in range(n):
if t[i][j] == 'X':
r[i] = 1
check = True
for i in range(n):
# print(i,n,len(r))
if r[i] > 0:
continue
for j in range(m):
if t[i][j] == 'X':
check = check and (t[i][j] == g[i][j])
for j in range(m):
if c[j] > 0:
continue
for i in range(n):
if t[i][j] == 'X':
check = check and (t[i][j] == g[i][j])
if check:
print(1)
else:
print(0)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 467ms
memory: 23500kb
input:
769 998 OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...
output:
1
result:
wrong answer expected 0, found 1