QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#395127#3002. Busy Boardohiostatescarlet#WA 399ms26896kbPython31.1kb2024-04-21 05:49:542024-04-21 05:49:55

Judging History

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

  • [2024-04-21 05:49:55]
  • 评测
  • 测评结果:WA
  • 用时:399ms
  • 内存:26896kb
  • [2024-04-21 05:49:54]
  • 提交

answer




r, c = map(int, input().split())

a = [["OX".find(i) for i in input()] for j in range(r)]
t = [["OX".find(i) for i in input()] for j in range(r)]

same = True
for x in range(c):
    for y in range(r):
        if a[y][x] != t[y][x]:
            same = False

if same:
    print(1)
else:
    allx = True
    for x in range(c):
        for y in range(r):
            if not a[y][x]:
                allx = False

    if allx:
        print(0)
    else:
        vr = [0 for _ in range(r)]
        vc = [0 for _ in range(c)]

        total = 0
        for y in range(r):
            s = sum(t[y])
            total += s
            if s <= 1:
                vr[y] = 1

        for x in range(c):
            s = sum(t[y][x] for y in range(r))
            if s <= 1:
                vc[x] = 1


        poss = True
        for x in range(c):
            for y in range(r):
                if a[y][x] == t[y][x] or (not t[y][x] and vr[y] and vc[x]) or (t[y][x] and (vr[y] or vc[x])):
                    pass
                else:
                    poss = False

        print(1 if total > 0 and poss else 0)

详细

Test #1:

score: 100
Accepted
time: 318ms
memory: 23268kb

input:

769 998
OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #2:

score: 0
Accepted
time: 399ms
memory: 26896kb

input:

977 998
OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #3:

score: -100
Wrong Answer
time: 392ms
memory: 26088kb

input:

941 973
XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

wrong answer expected 1, found 0