I TRIED LCA BUT IT GOT TLE ONLY 40 PERCENT SUBTASK PASSED HOW U PREPROCESS THE LCA
Nah, straight forward binary lifting
I was also getting partial, but then I saw FASTIO is recommended as input can be large, so after using FASTIO, I got full points.
I solved all, but very late, didn’t know binary lifting.
which advanced algorithm
?
Can you briefly describe it? What you did?
I know binary lifting.
Oh I see
just calculate sum from node root to x
now for a query the answer will be (sum(u)+sum(v)-2*sum(lca(u,v))
lca should be computed in LOGN otherwise you will get TLE (binary lifting part )
Yup I also did it by LCA with sparse table
how did you solve last problem , i tried half of diameter , but giving wa
ohh it was straightforward problem. idk what i was thinking. 
Ceil of half diameter.
Sure, so for each node assign the weight of it’s parent edge to it. And then precompute for the sum of all assigned values of nodes in the path from root to every node. Now for any 2 nodes. We can calculate the answer as ->
a[i]= weight of the edge connecting node i and it’s parent
S_i= Set of all nodes in the shortest path from root to i_{th} node
p[i] =\sum_{j \in S_i}a[j]
for any u,v ,
ans_{u,v}=p[u]+p[v]-2*p[lca(u,v)]
yaa , did the same , but didn’t work
Yes, it was well known problem. Thank you 
Can you please post your solution. I did the same thing but I still got wrong answer.
I guess you may have got WA due to int as i got he same.Converting weights array to long long worked for me.
anyone know about selection criteria for coding round of last year ?
will the ranklist made public?
orz