Hi. I was implementing my own HLD and I used this problem: CSES2134-Path Queries II in order to practice. But, the thing is, whatever I do it won't stop giving TLE on test case #9. To see if the time difference was huge compared to other solutions, I used the USACO Guide solution, but it also received a TLE verdict. Other codes from GitHub I've tried have the same result. Is this common for CSES to have such tight time limits or is there something wrong with this particular problem?








Auto comment: topic has been updated by turral (previous revision, new revision, compare).
CSES problem have a problem with time limit with all almost all problem so u need to optimize it so much you can try this template https://github.com/ShahjalalShohag/code-library/blob/main/Data%20Structures/HLD.cpp
Still TLE. Here's the code. Impossible tbh.
i did not understand your code so much as i read you try to write the HLD code by your self so it was not much clear
this my solution : https://cses.fi/paste/802c94708c36c11ff2cc3a/ you can read and get a better understanding
I don't know to which code of mine you are referring to, the one I linked is using your template, but anyways, thanks for your solution, I'll go on to try to understand why does it work.
You didn't understand me , the above link is template from ultimate topic list
my solution use the my template which i got AC using it
I've got it now. It's just that I was too burned out, so I asked claude to modify the template to fit the problem, being this my own original code (which I will try to optimize), but it seems it didn't do it correctly. I've read your solution and I get the main logic about how to implement the HLD, so I will try to implement it myself and hope not to get TLE. Thanks for the code!