A while back I solved the problem wxhtzdy ORO Tree and I had some problems with the time limit, but I managed to squeeze it below the 5s mark by, instead of calculating for each important node the value of the function, calculating the contribution of each important node to the original answer (link to AC submission). I thought that calculating the value of the function each time has a large constant factor and it turned out to be true. However, a few days ago I was helping a friend solve the problem and noticed that his code, with the same idea that would not work for me (link to the TLE submission), passed comfortably. Now, I am confused as to why my code is so inefficent. Could anyone help me point out the bottlenecks in my code?
i can confirm im the friend he's talking about and also he wasn't helping me he only told me how to impl it, also his code doesn't work cuz he has a skill issue and not cuz of bottles
also my ac submission: 249597306
orz sir!
Optimization puzzles can be tricky! Perhaps examining differences in implementation details or compiler optimizations could shed light on the efficiency gap.
why did you downvote him???? he literally asked why is the code inefficient??? he's not even a newbie he's a candidate master?? what's wrong with this community!!!
I suppot, bro. Even gave upvotes above :( It's a truly educative blog and asks original thing. But as yu told me before :((
It's perplexing why there's a downvote for a query about code efficiency, especially from someone at the candidate master level. It's disappointing to see this lack of support in the community.
Are you a bot?