QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#405123#3002. Busy BoardLspeedWA 692ms27228kbPython31.7kb2024-05-05 11:38:062024-05-05 11:38:15

Judging History

你现在查看的是最新测评结果

  • [2024-05-05 11:38:15]
  • 评测
  • 测评结果:WA
  • 用时:692ms
  • 内存:27228kb
  • [2024-05-05 11:38:06]
  • 提交

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)
elif ct2 == 0:
    if ct1 == 0:
        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] = 0

    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] = 0

    check = True

    # if sum(c) == 0 or sum(r) == 0:
    #     for i in range(n):
    #         for j in range(m):
    #             if t[i][j] != g[i][j]:
    #                 check = False

    for i in range(n):
        for j in range(m):
            if c[j] != 1 or r[i] != 1:
                check = check and (t[i][j] == g[i][j])

    if check:
        print(1)
    else:
        print(0)

详细

Test #1:

score: 100
Accepted
time: 447ms
memory: 23536kb

input:

769 998
OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #2:

score: 0
Accepted
time: 623ms
memory: 27228kb

input:

977 998
OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #3:

score: -100
Wrong Answer
time: 692ms
memory: 26676kb

input:

941 973
XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

wrong answer expected 1, found 0