QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#395128#3002. Busy Boardohiostatescarlet#WA 603ms26196kbPython31.6kb2024-04-21 06:02:462024-04-21 06:02:46

Judging History

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

  • [2024-04-21 06:02:46]
  • 评测
  • 测评结果:WA
  • 用时:603ms
  • 内存:26196kb
  • [2024-04-21 06:02:46]
  • 提交

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:
        v1r = [0 for _ in range(r)]
        v1c = [0 for _ in range(c)]

        v0r = [0 for _ in range(r)]
        v0c = [0 for _ in range(c)]

        total = 0
        for y in range(r):
            s = sum(t[y])
            total += s
            if s == 1:
                v1r[y] = 1
            elif s == 0:
                v0r[y] = 1

        for x in range(c):
            s = sum(t[y][x] for y in range(r))
            if s == 1:
                v1c[x] = 1
            elif s == 0:
                v0c[x] = 1

        wr = [0 for _ in range(r)]
        wc = [0 for _ in range(c)]
        for y in range(r):
            for x in range(c):
                if t[y][x] == 0 and v1r[y] and v0c[x] == 1:
                    v0c[x] = 2
                if t[y][x] == 0 and v1c[x] and v0r[y] == 1:
                    v0r[y] = 2


        poss = True
        for x in range(c):
            for y in range(r):
                if a[y][x] == t[y][x] or v1r[y] or v1c[x] or v0r[y] == 2 or v0c[x] == 2:
                    pass
                else:
                    poss = False

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

详细

Test #1:

score: 100
Accepted
time: 461ms
memory: 22924kb

input:

769 998
OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #2:

score: 0
Accepted
time: 603ms
memory: 26196kb

input:

977 998
OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #3:

score: 0
Accepted
time: 504ms
memory: 25756kb

input:

941 973
XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

1

result:

ok answer is 1

Test #4:

score: 0
Accepted
time: 36ms
memory: 10384kb

input:

65 983
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

ok answer is 0

Test #5:

score: 0
Accepted
time: 14ms
memory: 9668kb

input:

50 201
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

ok answer is 0

Test #6:

score: 0
Accepted
time: 301ms
memory: 17928kb

input:

949 507
OXOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOXOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...

output:

1

result:

ok answer is 1

Test #7:

score: 0
Accepted
time: 563ms
memory: 26060kb

input:

964 994
XOOOOOOOOOOOOOOOOXXXXOOXXOOOOOOOOOOOOXXOOOOXOOOOOOOOOOOXOOXOOXOOOOXOXOXOOOOOOOXOOXOOOOOOOOXOOXXOXOOOOOXOXOXOOOOOOOOOXOXOOOOOOOXXOOOOOOOOOXOOOXOXOOOOOOXXXXOOOOOOOOOOOOOOOOOXOOXOOOOOOOOOXOOOXXXOOOOOOOOOOOOXOOOOOXOXXOOOOOOOXOOOXOOOXOOOOOOOOOOXOOOOOOOXXOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOXOOOXXOXXOO...

output:

0

result:

ok answer is 0

Test #8:

score: -100
Wrong Answer
time: 28ms
memory: 10216kb

input:

992 30
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOXOOO
OOXOOOOOXOOOOOOOOOXOOOOOOOOOOO
OOOOOOXOOOOOOOOOOOOXOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOXOOOOOOOOOO
OOXOOOOOOOOOOXOOOOXOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOXOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOXOOO
OXOOOOOOOOOOOO...

output:

1

result:

wrong answer expected 0, found 1