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
Auto comment: topic has been updated by _Halabi (previous revision, new revision, compare).
Bro put some link Or something
https://codeforces.net/contest/932/submission/268393481
this the link of the problem ... i find the wa and got ac ..