Hi. In the 3rd problem of April Cookoff, i.e. Simple Operations (MINOPS), I’m getting an AC verdict even though I know for sure that my code is incorrect.

Here’s the AC Code : https://www.codechef.com/viewsolution/32103314

For the sample testcase,

1

abcdefap

axydefby

The number of islands = 2

The gaps are as follows = [1, 3]

(here i’ve included 1 as my code calculates the gap from the starting as well. So the substring,

‘a’ at index 0 is counted as a gap, although its before any island.

Now, in this problem the correct output should be 7.

When we ‘bridge’ the gap formed by ‘def’.

axxxxxxx

axxxxxxx ( x represents strings to be changed )

As, for 2 islands => result = 4 * 2 = 8

and, for 1 island => result = 1 * 7 = 7

But because I’ve taken the gap even before the first island, my algorithm selects the smaller value of 1 as the gap to be bridged.

And thus the answer i get is 5.

as follows,

xxxdefxx

xxxdefxx ( x represents the strings to be changed )

Yet, we can clearly see that still we have 2 islands! But I’m getting an AC verdict!? How?

So, although the answer is wrong, I’m still getting AC. @admin please look into this and solve this problem.