Codechef足球联赛蟒蛇

时间:2016-11-21 13:50:13

标签: python

def league(cases,teams,score=0):
    if(teams>1 and teams<140):
            a=[[0 for i in range(teams)]for j in range(teams)]
            b=[0 for m in range(teams)]
            c=[0 for n in range(teams)]
            for i in range(teams):
                for j in range(teams):
                    a[i][j]=int(input())
                    if(a[i][j]==1):
                        b[i]=b[i]+1
                    elif(a[i][j]==2):
                        c[i]=c[i]+1
                    if (score>b[i]):
                    score=score
                    else:
                    score=b[i]

            for i in range(teams):
                for j in range(teams):
                    if(a[i][j]==2 and b[i]==j and b[i]==score):
                        score=score+1

            for i in range(teams):
                if(b[i]+c[i]<score):
                    print('0')
                else:
                    print('1')

在我的python 3.5 ide上正常工作,但codechef显示错误!! 该怎么办 ?帮助

输入

第一行包含T(约20),测试用例数。然后是T测试案例。每个测试用例都有以下形式。

测试用例的第一行包含数字N(1 <= N <= 140),即联盟中的球队数量。

接下来的N行中的第i行包含N个数字ai1,ai2,...,ain。数字aij给出了第i支球队和第j支球队之间的比赛状态:

aij = 1  i-th team wins,
aij = 0 i-th team loses,
aij = 2 if the match has not taken place yet.
The input data is such that if i!=j, then aij + aji = 1 or aij = aji = 2. Moreover, aii = 0 for all i.

0 个答案:

没有答案