Комментарии
На usaxena95SOS Dynamic Programming [Tutorial], 4 года назад
0

I was reading this and started to solve the problems and suddenly whole blog just started showing this. Now I can't see the blog.

Unable to parse markup [type=CF_MARKDOWN]

Thanks bro, My bad, It worked

Damn, now I feel like this blog is important for many coders :P

I added this-> @my_username soft stack 2000000 in limits.conf, Is there any mistake in this line?

Yeah, sad!

Thank you very much!

Yes, I did it, But It didn't work somehow

На halin.georgeCodeforces Round #381 Editorial, 6 лет назад
0

Yeah, I also think so

На Jon.SnowCSES Tree section editorial, 6 лет назад
0

Thank you!

На Jon.SnowCSES Tree section editorial, 6 лет назад
+3

Post is itself a good one, just a add on, read this awesome blog by adamant on heavy- light decomposition, using this we can solve both path queries as well as subtree queries simultaneously.

На Jon.SnowCSES Tree section editorial, 6 лет назад
0

Can someone please give the link for problemset.

Auto comment: topic has been updated by shashankagrawal (previous revision, new revision, compare).

Ignore my above comment understand the mistake now. Again thank you!!!

Thank you very much, I used what you told and it worked.

But I have also done ~~~~~ if(u == p) continue; ~~~~~

So, If any node has atleast 1 child and adj[v][0] = p, then it will surely be swapped with adj[v][1], and then loop continues, and hence adj[v][0] will never be p except for leaves. So, Can you please elaborate more?

And Sorry for the confusion, But in the second submission I used a different idea for forming the heavy paths, which is I am using length of heavy path down the node instead of subtree size of that node.