Incorrect submission

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

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

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[i];

That the required sum will be minimum when the current element a[i] 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…

1 Like

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

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:

chuck mate