在codechef引导游戏问题中获取NZEC错误

2024-05-14 23:30:36 发布

您现在位置:Python中文网/ 问答频道 /正文

当我提供自定义输入时,我得到了正确的答案,但当我提供运行它时,codechef会在

rounds=int(input())

声明

p1=[]
p2=[]
lead=[]
pLead=[]
a,b=0,0
rounds=int(input())
for _ in range(int(rounds)):
    a,b=map(int,input().split())
    p1.append(a)
    p2.append(b)
    if _ ==0:
        lead.append(a-b)
    else:
        lead.append(a-b+lead[_-1])
    pLead.append(abs(lead[_]))
if lead[pLead.index(max(pLead))]<0:
    print(2,-1*lead[pLead.index(max(pLead))])
else:
    print(1,lead[pLead.index(max(pLead))])

Tags: 答案inputindexifelsemaxintprint

热门问题