Can anyone help me understand this? Should I share the code?
Ask on the problem page. And no you can’t share your code.
No you should definitely not share the code.
If you are getting TLE, possible reason is that your code is stuck in some infinite loop.
If your code is passing subtask 1 and TLE is for subtask 2, then comeup with an optimized solution.
Thanks for the response. The problem page has some issue, after I post it hangs and my question doesn’t get posted.
Thanks for your response. Yes, TLE is occurring in Subtask 2. There is no infinite loop. Yes, I need to optimize the solution. However I have not understood the cause behind TLE yet.
Analyze your code carefully, It is probably because you are using brute force.
And don’t discuss about the live problems here.