Help in E.Duff in the army

Правка en1, от M.A.H.M.O.O.D, 2016-12-02 15:30:58

Good day CF community.

Today I tried to challenge myself and solve a hard problem and I did...kinda.

Right now I'm stuck in test 8 I have no idea what's wrong with my solution could somebody please help me out ???

Here is my code 22656856 and the problem 588E - Duff в армии.

My idea is to find the IDs from node u to node 1 and from node v to node 1 and from LCA(u,v) to node 1 and then my answer will be (IDs(u) + IDs(v) — IDs(LCA(u,v))) I'm not sure if the idea is wrong or the implementation.

I'll be very grateful for any kind of help.

Thank you for reading.

:)

Теги trees, lca, sparse table, help

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский M.A.H.M.O.O.D 2016-12-02 15:30:58 627 Initial revision (published)