Incorrect submission

beginner
chefsum
incorrect
python27
submission
sum

#1

problem: https://www.codechef.com/problems/CHEFSUM
my solution: https://www.codechef.com/problems/CHEFSUM
The code is running fine in IDLE but code chef shows it as incorrect submission
Please help


#2

https://discuss.codechef.com/questions/110977/detailed-editorial-for-beginners follow this


#3

Mate

You just need a simple observation in this problem,

the Chef-sum = prefixSum(i) + SuffixSum(i) is same as Sum of whole array + a*;

That the required sum will be minimum when the current element a* is minimum…

So we just need to find the leftmost index of minimum element in array…

min = 1000000 // any large value

index = -1

for i in range (0, k)

x = input()

if(x < min)

     min = x

     index = i

print(i)

PS:i don’t know Python, so rectify minor errors of input…

Please Upvote and Accept if you find this helpful…

Feel free to ask anything…


#4

is it necessary to mention upvote ? dying for laddus? haha


#5

Not as much as you, @raj79

By the way, UPVOTES and ACCEPTED ANSWER means that the doubt of the person asking question has been clarified… :expressionless:


#6

chuck mate