Is this the same problem as Cherry and Bits

In yesterday’s rated contest on Codechef, isn’t THIS, the same problem asked, just without the flipping condition? Even CODE was given in the comments section. I saw many submissions and they had the same code, just we have to swap when the mat array is odd and print.
@admin

Yes, it’s unfortunate that a similar problem has been discussed. But it’s anyway an easy ‘natural’ problem, and so not particularly surprising. We should definitely have searched more and that’s our mistake.
But the contest will remain rated.

6 Likes

Hi Setter here!

I was not aware of that Codeforces Blog.

Also in the blog I can see that the implementation of the Difference Array is told not the given problem. You can also see in our Editorial too that we have added Difference Array as a Prerequisite which you should be aware of I guess.

All in the problem you need to figure out that it can be solved by using Difference Array.

1 Like

Thank you for clarifying. Actually I saw too many similar solutions for this problem and its same as the code in the comment. Example- Sol1, Sol2, Sol3, Sol4 (these are some randomly taken solutions). There are many more, exactly similar. The difference in all the solution is just flipping. I don’t know if they saw this blog or not. Anyways, it was a very good problem, got to learn some new things :slightly_smiling_face:

Hi! They all implemented the Difference Array, if you would pick any AC solution you will get implementation like this only since the Optimal solution was with Difference Array Only. Also if you find any other approach please feel free to share it. Thanks

2 Likes