Hi,
I'm trying to solve problem D "Beard Graph" from round #112.
I understand the idea explained in the editorial (http://codeforces.net/blog/entry/4124) but i don't see how to use/apply a segment/fenwick tree on this problem. How can I enumerate the paths in such a way that i can use a segment tree on it?
Thanks in advance and Merry Christmas for everyone :)