SNCOUP - Editorial

Else you can paste your code as a answer so that other users can also take a chance to find error case

1 Like

thanxx man.

@urdarinda

Sorry I’m unable to find any case for which your code is not working.

thank you for trying! @sai_rathan
Can anyone provide a test case for which the code does not work?

1 Like

I Dare you if you can tell where it will fail.

@urdarinda

if(arr[0][i]=='*' && arr[1][i]=='.' && arr[0][i+1]=='.' && arr[1][i+1]=='*'){
                ans--;
                i++;
            }
            else if(arr[0][i]=='.' && arr[1][i]=='*' && arr[0][i+1]=='*' && arr[1][i+1]=='.'){
                ans--;
                i++;
            }

I think in the if condition your trying to access a[0][i+1] but when you are accessing last element it will try to access its next element which is not present. I think this is causing some trouble for larger value of ‘n’ though I’m not sure.

Nice work @sai_rathan :slight_smile:

1 Like

The test cases already found where you were wrong so no point in dare XD.

On a side note- Request nicely and people will help :slight_smile:

2 Likes

@sauravsinha137
W9JMuW - Online C++0x Compiler & Debugging Tool - Ideone.com answer is 3!

@nishith365
mDZwbq - Online C++0x Compiler & Debugging Tool - Ideone.com answer is 3!

@karthikeya123

Your code gives a compilation error because you have used scanf function for taking test case input without including stdio.h .
Correct me if I’m wrong.

@manish7294

There is an error in your logic for case 1.

Now consider a test case

5

.*.*.

*.*.*

Answer according to your logic will be 4 but correct answer is 3

@floating_point

Your code fails for this case

Input:

3

.**

**.

Your Output: 2

Expected Output :3

@sai_rathan my program i also giving output as 3. As the 1st and 2nd column have vertical adjacent snakes so this is my case 2.

@sai_rathan
It did work without any compilation error.

i hope you guys can understand this
i cant upload image due to lack of karma and on pasting the code it appears like this
but there is no compilation error just tell where the logic went wrong
thanks

Share your submission link

Fixed the format.

Users are requested to provide a submission link instead of pasting the entire code.

1 Like

@kunal12libra

Your code doesn’t work for the test case below:

Input:

.**

**.

Your code’s output: 2

Expected Output : 3

1 Like