TLE in CHEFSHIP(CookOff)

Thank you so much i will try this

Now test cases have been changed. Now it will not pass but always try to write simple codes if you are not reducing time complexity by writing complex ones.

1 Like

Yeah!

I think there is bug with system when you submit this solution. It should be TLE.

why substr works and naive gives tle ???
i think both have o(n) complexity

i am submitting an accepted solution now it’s giving tle i think they should have to make strong test cases before contest.because after getting tle by naive no one will try substr because both have o(n) complexity but apparently second will work.but overall good question i will learn kmp and string hashing now.

Our solution does looks quite similar so I may nitpick making vector to store the sizes, that could be done using loops too I think.

1 Like

I don’t think vector is an obstacle to AC in my solution.