i tried to solve this problem but i have WA 19 , many trials without result so i hope some one can help me <3↵
↵
↵
my solutin idea : ↵
↵
for each u we preprocess it that we store for it the 1<<k elemnt after u in valid sequence dp[u][k] and sum untill this elemnt sum[u][k] >> so we can ans queryies about u in log time[↵
↵
↵
submission: : 268374991]
↵
↵
my solutin idea : ↵
↵
for each u we preprocess it that we store for it the 1<<k elemnt after u in valid sequence dp[u][k] and sum untill this elemnt sum[u][k] >> so we can ans queryies about u in log time
↵
↵
submission