Блог пользователя ologn_13

Автор ologn_13, 12 лет назад, По-английски

Hi all! I have been caught in this problem from past few hours....my thoughts are in following way:- first we'll do DFS and store number of nodes in the subtree rooted at every node..after this we would take all these numbers in sorted order and iterate from both sides(start and end) and print each pair till we reach middle..but this won't work if more than 2 subtree has same number of nodes.....please help here... or please discuss if there is any other simpler way than this..thanks in advance!! [CUT] EDIT: The problem is solved. From here it was nothing but to just take an "OR" of all combinations possible from each node with overall array of possible combinations.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
3 года назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

Any one please help with the apporaches of this problem. Problem My Submission Though I have solved the problem. But I have seen some interesting solutions which have used something similar to bitmasking which I am not able to understand. I would be thankful if any one could help me with that. demoralizer submission using bitmask

P.S. This problem doesn't have any editorial on so it will be helpful if this blog could be used for this problem's editorial.