Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Help please! Why is it wrong (Round #381 div2 D)

Revision en1, by memeset, 2016-11-26 04:20:50

Hello everyone,

For the recent codeforces round #381, I submitted this code for the div2D/div1B question here. I am not sure why it is wrong...

The basic idea of my code was that I use binary lifting to store the 2^kth ancestor and the distance to the 2^kth ancestor in bparent[][] and bdist[][]. I then binary search for the highest ancestor that each node is controlled by and store the starting and ending points in event[], which i can just dfs and sum up in my function solve().

Could somebody please tell me where I went wrong in my code? Any help would be appreciated.

Thanks!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English memeset 2016-11-26 04:20:50 748 Initial revision (published)