Test Case : CFS2003

My submission: https://www.codechef.com/viewsolution/38007825

@shr_mandade @shantanu_25 @hritikrbelani @randomking, could you please tell the test case where my code is failing?


We didn’t considered the case when k = 2 . We got to know about it in the middle of the contest . Sorry for the inconvenience . We will take care from next time . Hope you enjoyed the other questions . Thanks for participating.

But accepted solutions and my solution are giving same answer for k = 2?? What was the exact test case??

@samarth2017 can you please tell why this solution is failing : https://www.codechef.com/viewsolution/38006346
And how did you solve it?

Our test files are wrong for k = 2 .
check this test case : 1
7 2
2 6
Expected answer “2 3” (1->3->5->7, 1->2->6->7)
But by our checker “1 3” (only considering 1->2->6->7)

Maybe you got WA because Test cases were wrong.
Btw, I solved it using graphs, made a directed graph and then simple BFS.

1 Like

My solution gives correct output for this test case. Unfortunately WA. :neutral_face:

I think that I was lucky that I got AC even after the wrong test cases.

I think you didn’t see the test case:
7 2
2 6
This was a test file whose output was wrong, your code is also giving wrong output.


How did so many people solve this problem in contest despite the incorrect test case? Is there some strategy for identifying these situations as opposed to just thinking that your code has a bug?

1 Like

It is safe to say that all of us messed up in the same way as the problem setters did xD

1 Like