Firstly, let us consider a simpler problem: Let us have similar queries, yet
without the "time-stamp", and all nodes are either 0 or 1 (and we would like
the sum). Now if this would be path (not a tree), it could be easily solved
with segment tree (fenwick tree or similar) ... well obviously - simply ask for
answer on segment.

Statistics

31% Solution Ratio
IOI_StfuFfsEarliest, Mar '18
IOI_StfuFfsFastest, 663974.8s
Tanzir5Lightest, 52 MB
IOI_StfuFfsShortest, 2644B
Toph uses cookies. By continuing you agree to our Cookie Policy.