比赛大厅准备A20J运行时错误

时间:2018-11-30 11:51:48

标签: python runtime-error

A2oj.com,运行时错误
问题#22

最近我正在从a2oj解决以下问题。

https://a2oj.com/p?ID=22

我对这个问题的解决方案是:

# to check for adjacent items in a 2d array
# just check the item next to it, below it and diagonal to it

t = int(input())
o = []
while t >= 1:
    n,m = map(int,input().split())
    c = 0
    li = []
    uni = []
    while c < m:
        li.append(map(int,input().split()))
        c += 1
    r = 0
    co = 0
    while r < n-1:
        c = 0
        while c < m-1:

            # if the place is empty skip checking
            if li[r][c] == -1:
                c += 1
                continue

            # if university is already counted also skip checking it
            if li[r][c] in uni:
                c += 1
                continue

            if li[r][c] == li[r][c+1]:
                uni.append(li[r][c])
                co += 1

            if li[r][c] == li[r+1][c+1]:
                uni.append(li[r][c])
                co += 1

            if li[r][c] == li[r+1][c]:
                uni.append(li[r][c])
                co += 1


            c += 1
        r += 1
    o.append(co)
    t -= 1

for w in o:
    print(w)

此代码对于给定的示例非常适用。但是,当我将其提交给a2oj在线评审时,我遇到了运行时错误。我也不知道为什么会收到错误消息。你能告诉我如何知道a2oj平台中的错误吗?或者可以帮我提供代码

0 个答案:

没有答案