Compilation of Edge Cases for SNCOUP

Greetings!

We have recently witnessed a huge surge and request of people asking for edge cases, or cases where their code is failing. Hence, this thread is a list of all the tricky cases i have seen so far. In case you have any other case to add, answer below. For any correction, please COMMENT on that answer (whose test cause you think has some error).

Also, in case you pass all the given cases here, tell us that you need more help. (And dont forget to add the case here as an answer when you find the edge case!)

(PS: There might be a possibility of error in value of n and actual string length, due to human inaccuracy. Users are requested to overwrite the value of n i input with the length of either of two strings.)

1.Boat(1) + Small Boat(1)+ Mirage(2)

4
7
*.....*
.*****.
7
.*****.
*.....*
11
...*...*...
....***....
11
....***....
...*...*...

Expected Output-
5
5
3
3

2.Lets Zig-Zag! (4)

4
7
..*..**
*..**..
6
*.*.*.
...*..
8
*.*...*.
.*..*..*
7
...*.*.
.**..**

Expected Output
4
3
3
4

3.Mind the V!(2)

2
6
..*.*.
.*...*
6
.*...*
..*.*.

Expected Output
2
2

Well, these were the test cases i had to care for in my code when i debugged. In case your doubt still persists, COMMENT the link of your code on the Q and I ,or other users, will look for more (and add the test cases here).

(In case you are unable to comment, its fine, i will convert it into a comment. I want that answers should be there only for test cases.)

EDIT-

Another Tricky one (for some approaches)

1
10
***.**..*.
.*...****.

Expected Output
8

Another one-

  Input
        1
        5
        .*..*
        ...*.
        Your Output
        0
        Expected Output
        2
1 Like

The thread is still growing and needs help of fellow members. Any edge cases you people discover, please make sure to put here as an answer. It will surely help some other fellow coder here! :slight_smile:

1 Like

…*
*…**.

This one was essential in debugging my solution

EDIT (From @vijju123)- The expected Output for above case is 3. Full test case-

1
7
*..*..*
*...**.
1 Like

1

10

*...*....*

.**...*...

ANSWER:3

1 Like

Hey thanks for those cases, that answers many questions by people asking for cases. :slight_smile:

Thanks for the appreciation dear :slight_smile:

Can someone please tell me which test case my code is failing for?
https://www.codechef.com/viewsolution/13990507
Thankyou in advance.
P.S. It is passing all the above test cases given.

if no one answers in an hour, i will have a look at it :slight_smile:

thanks for the test cases

1 Like

Found the test case.
Thank you for replying.

Your query is resolved?

Can you share it here? :slight_smile:

@hruday968, thank you so much, that was the test case I was failing for.

Can someone please tell me which test case my code is failing for, all the above test cases are working? https://www.codechef.com/viewsolution/13971726 Thank you.

Input
        1
        5
        .*..*
        ...*.
        Your Output
        0
        Expected Output
        2

It is giving me 2 when I am running it locally on my laptop

Run it on codechef IDE once. Its giving me a 0, checked thrice.

Its coming from this line-

if(a0==0 && a1==0)
	c=0;

it is giving 2 in my compiler too

Oh God! Lmao. @devangm, your code is on UNDEFINED behaviour.

Please use EITHER scanner/printf OR cin/cout after typing

ios_base::sync_with_stdio(0);
	cin.tie(0);

If you use both scanner/printf and cin/cout after typing above 2 statements, your program will show undefined behaviour, giving different output on different compiler.

Damn! That is how you lose out on an online elimination spot. :confused: