Range based update on array

I am not getting an answer by using range based update on the array(O(1)) on CodeChef, but I am getting the correct answer on dev c++ IDE what would be the problem.