SPECIES - Editorial

Hi @kingofnumbers, I realised that the test cases for this problem are pretty weak. My solution (link text) fails on many testcases such as the one below even though it got an AC.

4



???B

I hope such cases are overlooked in future so that only the accurate submissions get Accepted.

yes this worked, but i still didn’t get what the problem really is, when I am considering n in all of the functions and the code is checking in that n x n matrix only O_O

You might have crossed nxn while checking for surrounding points i.e. all 4 directions or something similar.

1 Like

Why do you think so? And remember about multiple test cases (T ≤ 50).

1 Like

Hi @errichto, I have coded my solution exactly as you guys have explained in the editorial but my solution is failing for Subtasks 2 and 3. Can you post the test cases and expected outputs for all subtasks as the competition is now over? It can help me and many others debug our solution :slight_smile:

A similar problem was there in INOI this year, not really same(not complaining), which used similar concepts. I wish I solved the problem back then.

1 Like

Just to increase the feels, the SCHEDULE problem for this march long was like…well…we had an editorial of it right under our nose at the discussion forum XD

Hi @errichto, My solution is also same as described in the editorial. It would be great if anyone can tell some corner cases. My solution failed on subtask 2 and 3. Corner cases of subtask 2 would be helpful as the solution is pretty straightforward for that.

please see this!

@pkacprzak

@tni_md you cause overflow on subtasks 2 and 3. Change the type of ans variable from int to long long and you’ll get accepted https://www.codechef.com/viewsolution/13187540

Okay thanks :slight_smile:

For me it was this case

2

G?

Answer is 0 but my code was giving 1 as output.

To compute connected components we can use DSU as well. Here.