SNELECT - Editorial

hi
have a small problem here
my solution is present in the link CodeChef: Practical coding for everyone
i am getting wrong answer as the result but my c compiler is not giving any wrong output i am scratching my head at this please tell me for which case my answer is wrong
appreciate any help
thanks

@deeptamandas
There are cases where you are subtracting the same snake twice from your total snake count.
For Example consider the testcase:

1
msmmssss

Expected Output : “tie”.
Your Output : “mongooses” (because you subtracted the count for the first snake twice) .

MY code is working fine in blueJ for all possible outputs but it is still giving runtime error NZEC
https://www.codechef.com/viewsolution/14688892

Can someone please have a look at my solution and tell why it is wrong? It seems to pass all test cases.

https://www.codechef.com/viewsolution/15592785

https://www.codechef.com/viewsolution/15954256
can anybody help me out …why i m getting wrong ans

try

1

msssssmsm

tie

this test case will solve your doubt

Someone help me!!!
https://www.codechef.com/viewsolution/18228793

C# : CodeChef: Practical coding for everyone

SPOILER : Basically I replace all “sm” with “M” , then same with “ms”,
then count “s” for snakes and “M”/“m” for mongooses.

I ran multiple scenario’s and all check ok locally… did I miss anything?

I know, it’s probably part of the challenges on CodeChef, but looking at all these posts here, I wonder why better test feedback is not provided after submission, like in CodeWars.Com for instance…
(ooh, I mentioned a competitor? :wink: )

For the below Input:

1

sssmm

The output of your solution is:

mongooses

Whereas, the expected output should be:

tie

Because, the mongoose at position 4 will eat the snake at position 3.
Therefore, only 2 snakes would be left and the number of mongooses is also 2. Hence, the output should be tie.

Hey refer my solution below, did using boolean array to keep track of eaten and non-eaten snakes. :slight_smile:

@suddu, In the first loop you may look for snakes outside the string.

What test cases i am missing?
CodeChef: Practical coding for everyone

What’s wrong with my solution??

https://www.codechef.com/viewsolution/44086661

https://www.codechef.com/viewsolution/45832432
This is my solution which seems correct but giving the wrong answer. I have tried running different cases and I hope it works fine. But I couldn’t understand why it is giving the wrong answer. I am new to competitive programming and just started practice. Could you please help me out?