CHEFSHIP - Editorial

Hi all,

Test cases are updated. We can’t rejudge the contest solutions but in practice, you will have new test cases.

14 Likes

I dont know how brute force n^2 soln get passed in the contest .
i have seen many people code passed in n^2.
#weak test case

1 Like

what will happen now

I used substr() and it passed. Check my submission.

2 Likes

Can anyone please tell me why this solution is wrong?
My solution-CodeChef: Practical coding for everyone

Can you share the link to your code?

Bro can you tell where i am getting wrong?

My suggestions would be to make strong testcases. This is serious issue please take care next time.

That’s why cf is better.

5 Likes

And many people have passed n^2 so better rejudge it

1 Like

@rishup_nitdgp can you please explain in which scenario this statement will execute ??

Hello, this is very good. I used a n^2 brute force method and got runtime error. I am not very familiar with rolling-hashes and want to learn. Would it be possible if you commented your Hashing class in the answer key? That would be extremely helpful, Thank you so much.

1 Like

Naive string matching with brute force will exceed the time limit right?anyone?

Can anyone tell me what’s wrong in my code? I am getting Wrong Answer Verdict everytime.
LINK:
https://www.codechef.com/viewsolution/33307144

Why do we require to compute lsp1[0] and lsp1[1],can u please elaborate litttle

don’t over-analyse the problem sometimes

The test cases were very poorly designed. Many O(n^2) solutions got accepted.

Looking at the constraints I straight away rejected this brute force solution and was therefore thinking about any other better solution during the entire contest and was unable to solve this problem during the contest.

4 Likes

why am i getting TLE here?? CodeChef: Practical coding for everyone @rishup_nitdgp

Designing a solution by keeping the constraints in mind is always recommended. Why waste time on writing a code which will eventually fail due to memory limit or time limit?

The problem here was with the test cases which were not in accordance with the constraints. Many programmers would have discarded this brute force solution by simply looking at the constraints.

6 Likes

Editorial Video Of Chef Chefina and their Friendship using Rabin Karp Algorithm and Prefix Sum is Here!
Check :- Chef Chefina and Their Friendship (CHEFSHIP) | May CookOff Codechef | Rabin Karp n Prefix Sum - YouTube
Subscribe for Latest Editorial Videos!
Enjoy Watching! :smile:

1 Like