You are not logged in. Please login at www.codechef.com to post your questions!

×

Deputy Chef problem in Beginner section facing runtime Error

Hi all, I am facing a runtime error for my code of Deputy chef problem in beginner section.Kindly have a look at my code, it shows successfully executed for the test cases, but when I submit it shows runtime Error. Here is my code:

  1. t=int(input('Enter test cases: ')) while(t!=0): n=int(input('Enter people in the formation: '))
    a,d=[],[]
    a=list(map(int,input('Enter attack value: ').split()))
    d=list(map(int,input('Enter Defense value: ').split())) sum=[]
    zeroth=int(a[1]+a[len(a)-1])
    sum.append(zeroth) for i in range(1,len(a)-1): p=0 p=a[i-1]+a[i+1] sum.append(p) last=int(a[len(a)-2]+a[0])
    sum.append(last) q=[i - j for i, j in zip(d,sum)] r=max(q)
    if(r<=0): print(-1) else:
    print(d[q.index(max(q))]) t-=1

asked 14 Mar, 15:43

rajatalpha9786's gravatar image

0★rajatalpha9786
11
accept rate: 0%

edited 18 Mar, 16:07

Share a link to your submission.

(18 Mar, 17:03) akashbhalotia5★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×280

question asked: 14 Mar, 15:43

question was seen: 48 times

last updated: 18 Mar, 17:03