buyone get one problem

What is the problem with this code for BUY1GET1. I have uploaded two program first was working fine but exceeded the time limit. so I changed the algorithm and this is the result. I have tried several test cases, out comes correctly in my system. I also tried testing both my programs, with same inputs and they produce same results. but the judge gives “Wrong Answer” for my second program. where did I go wrong??

(code removed by @cyberax)

This discussion is also relevant for the questions on this forum :

http://discuss.codechef.com/questions/855/what-kind-of-comment-should-i-post-on-the-problem-page

Please read it carefully. Thanks.

1 Like

apologies…