So, while solving random problems from the problemset I came across the problem 1114D - Flood Fill. After wracking my brain for so long I couldn't come up with any solution within the given constraints.
But when I looked at all the submissions, almost everyone approached it in the same incorrect way. It is wrong, as I have a counter test cases for these solutions, which are almost the same as the editorial.
For example, let's take the editorial submission — 49738289 . For the test case
5
1 2 1 3 1
Actual Answer
It's obvious the answer is 2. Change the 2nd and 4th cell into 1, and bingo you have the same color everywhere in 2 moves.
Program's Output
If you run it locally and check, you will find it outputting 3. This, I believe , is also the Jury's Solution,
Actual Solution
I believe the actual solution is a DP which runs in cubic time, somewhat similar to the problem 1132F - Clear the String. But given the constraints, unless the test cases are weak, I highly doubt a cubic solution can pass. So the constraints as well as the Jury's solution needs to be changed.
Edit:- I misunderstood the problem statement. The solution is correct.